@@ -296,20 +296,18 @@ def _parse_structured_fill_value(fill_value: Any, dtype: np.dtype[Any]) -> Any:
296
296
"""Handle structured dtype/fill value pairs"""
297
297
try :
298
298
if isinstance (fill_value , list ):
299
- fill_value = tuple (fill_value )
299
+ return tuple (fill_value )
300
300
if isinstance (fill_value , tuple ):
301
- fill_value = np .array ([fill_value ], dtype = dtype )[0 ]
301
+ return np .array ([fill_value ], dtype = dtype )[0 ]
302
302
elif isinstance (fill_value , bytes ):
303
- fill_value = np .frombuffer (fill_value , dtype = dtype )[0 ]
303
+ return np .frombuffer (fill_value , dtype = dtype )[0 ]
304
304
elif isinstance (fill_value , str ):
305
305
decoded = base64 .standard_b64decode (fill_value )
306
- fill_value = np .frombuffer (decoded , dtype = dtype )[0 ]
306
+ return np .frombuffer (decoded , dtype = dtype )[0 ]
307
307
else :
308
- fill_value = np .array (fill_value , dtype = dtype )[()]
308
+ return np .array (fill_value , dtype = dtype )[()]
309
309
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
313
311
314
312
315
313
def parse_fill_value (fill_value : Any , dtype : np .dtype [Any ]) -> Any :
0 commit comments