@@ -294,22 +294,21 @@ def parse_metadata(data: ArrayV2Metadata) -> ArrayV2Metadata:
294
294
295
295
def _parse_structured_fill_value (fill_value : Any , dtype : np .dtype [Any ]) -> Any :
296
296
"""Handle structured dtype/fill value pairs"""
297
+ print ("FILL VALUE" , fill_value , "DT" , dtype )
297
298
try :
298
299
if isinstance (fill_value , list ):
299
300
fill_value = tuple (fill_value )
300
301
if isinstance (fill_value , tuple ):
301
- fill_value = np .array ([fill_value ], dtype = dtype )[0 ]
302
+ return np .array ([fill_value ], dtype = dtype )[0 ]
302
303
elif isinstance (fill_value , bytes ):
303
- fill_value = np .frombuffer (fill_value , dtype = dtype )[0 ]
304
+ return np .frombuffer (fill_value , dtype = dtype )[0 ]
304
305
elif isinstance (fill_value , str ):
305
306
decoded = base64 .standard_b64decode (fill_value )
306
- fill_value = np .frombuffer (decoded , dtype = dtype )[0 ]
307
+ return np .frombuffer (decoded , dtype = dtype )[0 ]
307
308
else :
308
- fill_value = np .array (fill_value , dtype = dtype )[()]
309
+ return np .array (fill_value , dtype = dtype )[()]
309
310
except Exception as e :
310
- msg = f"Fill_value { fill_value } is not valid for dtype { dtype } ."
311
- raise ValueError (msg ) from e
312
- return fill_value
311
+ raise ValueError (f"Fill_value { fill_value } is not valid for dtype { dtype } ." ) from e
313
312
314
313
315
314
def parse_fill_value (fill_value : Any , dtype : np .dtype [Any ]) -> Any :
0 commit comments