@@ -296,20 +296,18 @@ def _parse_structured_fill_value(fill_value: Any, dtype: np.dtype[Any]) -> Any:
296296 """Handle structured dtype/fill value pairs"""
297297 try :
298298 if isinstance (fill_value , list ):
299- fill_value = tuple (fill_value )
299+ return tuple (fill_value )
300300 if isinstance (fill_value , tuple ):
301- fill_value = np .array ([fill_value ], dtype = dtype )[0 ]
301+ return np .array ([fill_value ], dtype = dtype )[0 ]
302302 elif isinstance (fill_value , bytes ):
303- fill_value = np .frombuffer (fill_value , dtype = dtype )[0 ]
303+ return np .frombuffer (fill_value , dtype = dtype )[0 ]
304304 elif isinstance (fill_value , str ):
305305 decoded = base64 .standard_b64decode (fill_value )
306- fill_value = np .frombuffer (decoded , dtype = dtype )[0 ]
306+ return np .frombuffer (decoded , dtype = dtype )[0 ]
307307 else :
308- fill_value = np .array (fill_value , dtype = dtype )[()]
308+ return np .array (fill_value , dtype = dtype )[()]
309309 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
310+ raise ValueError (f"Fill_value { fill_value } is not valid for dtype { dtype } ." ) from e
313311
314312
315313def parse_fill_value (fill_value : Any , dtype : np .dtype [Any ]) -> Any :
0 commit comments