Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions nibabel/volumeutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from functools import reduce
from operator import getitem, mul
from os.path import exists, splitext
from typing import Any

import numpy as np

Expand Down Expand Up @@ -1365,7 +1366,7 @@
return aff


def rec2dict(rec: np.ndarray) -> dict[str, np.generic | np.ndarray]:
def rec2dict(rec: np.ndarray) -> dict[str, Any]:
"""Convert recarray to dictionary
Also converts scalar values to scalars
Expand All @@ -1387,7 +1388,9 @@
>>> d == {'x': 0, 's': b''}
True
"""
dct = {}
dct: dict[str, Any] = {}
if rec.dtype.fields is None:
return dct

Check warning on line 1393 in nibabel/volumeutils.py

View check run for this annotation

Codecov / codecov/patch

nibabel/volumeutils.py#L1393

Added line #L1393 was not covered by tests
for key in rec.dtype.fields:
val = rec[key]
try:
Expand Down
Loading