Skip to content

Commit d8160e2

Browse files
authored
Merge pull request #1424 from jhlegarreta/FixTypecheckErrors
STYLE: Fix type checking errors in `volumeutils.rec2dict`
2 parents 3485287 + bfaa984 commit d8160e2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

nibabel/volumeutils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,7 @@ def shape_zoom_affine(
13651365
return aff
13661366

13671367

1368-
def rec2dict(rec: np.ndarray) -> dict[str, np.generic | np.ndarray]:
1368+
def rec2dict(rec: np.record) -> dict[str, np.generic | np.ndarray]:
13691369
"""Convert recarray to dictionary
13701370
13711371
Also converts scalar values to scalars
@@ -1388,7 +1388,7 @@ def rec2dict(rec: np.ndarray) -> dict[str, np.generic | np.ndarray]:
13881388
True
13891389
"""
13901390
dct = {}
1391-
for key in rec.dtype.fields:
1391+
for key in rec.dtype.fields or ():
13921392
val = rec[key]
13931393
try:
13941394
val = val.item()

0 commit comments

Comments
 (0)