Skip to content

Commit 8d6bfba

Browse files
committed
type: Address fresh complaints
1 parent cfa3180 commit 8d6bfba

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

nibabel/deprecated.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
from .deprecator import Deprecator
99
from .pkg_info import cmp_pkg_version
1010

11-
if ty.TYPE_CHECKING:
12-
P = ty.ParamSpec('P')
11+
P = ty.ParamSpec('P')
1312

1413

1514
class ModuleProxy:
@@ -44,7 +43,7 @@ def __repr__(self) -> str:
4443
return f'<module proxy for {self._module_name}>'
4544

4645

47-
class FutureWarningMixin:
46+
class FutureWarningMixin(ty.Generic[P]):
4847
"""Insert FutureWarning for object creation
4948
5049
Examples

nibabel/nifti1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ class Nifti1Header(SpmAnalyzeHeader):
843843
single_magic = b'n+1'
844844

845845
# Quaternion threshold near 0, based on float32 precision
846-
quaternion_threshold = np.finfo(np.float32).eps * 3
846+
quaternion_threshold: np.floating = np.finfo(np.float32).eps * 3
847847

848848
def __init__(self, binaryblock=None, endianness=None, check=True, extensions=()):
849849
"""Initialize header from binary data block and extensions"""

nibabel/volumeutils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
DT = ty.TypeVar('DT', bound=np.generic)
3636

3737
sys_is_le = sys.byteorder == 'little'
38-
native_code = '<' if sys_is_le else '>'
39-
swapped_code = '>' if sys_is_le else '<'
38+
native_code: ty.Literal['<', '>'] = '<' if sys_is_le else '>'
39+
swapped_code: ty.Literal['<', '>'] = '>' if sys_is_le else '<'
4040

4141
_endian_codes = ( # numpy code, aliases
4242
('<', 'little', 'l', 'le', 'L', 'LE'),

0 commit comments

Comments
 (0)