@@ -294,22 +294,21 @@ def parse_metadata(data: ArrayV2Metadata) -> ArrayV2Metadata:
294294
295295def _parse_structured_fill_value (fill_value : Any , dtype : np .dtype [Any ]) -> Any :
296296 """Handle structured dtype/fill value pairs"""
297+ print ("FILL VALUE" , fill_value , "DT" , dtype )
297298 try :
298299 if isinstance (fill_value , list ):
299300 fill_value = tuple (fill_value )
300301 if isinstance (fill_value , tuple ):
301- fill_value = np .array ([fill_value ], dtype = dtype )[0 ]
302+ return np .array ([fill_value ], dtype = dtype )[0 ]
302303 elif isinstance (fill_value , bytes ):
303- fill_value = np .frombuffer (fill_value , dtype = dtype )[0 ]
304+ return np .frombuffer (fill_value , dtype = dtype )[0 ]
304305 elif isinstance (fill_value , str ):
305306 decoded = base64 .standard_b64decode (fill_value )
306- fill_value = np .frombuffer (decoded , dtype = dtype )[0 ]
307+ return np .frombuffer (decoded , dtype = dtype )[0 ]
307308 else :
308- fill_value = np .array (fill_value , dtype = dtype )[()]
309+ return np .array (fill_value , dtype = dtype )[()]
309310 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
313312
314313
315314def parse_fill_value (fill_value : Any , dtype : np .dtype [Any ]) -> Any :
0 commit comments