Skip to content

Commit

Permalink
ENH: Drop typing.Type for type
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Mar 26, 2023
1 parent 45cdb1c commit 9f189c6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
4 changes: 1 addition & 3 deletions nibabel/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@
"""
from __future__ import annotations

from typing import Type

import numpy as np

from .arrayproxy import ArrayProxy
Expand Down Expand Up @@ -895,7 +893,7 @@ def may_contain_header(klass, binaryblock):
class AnalyzeImage(SpatialImage):
"""Class for basic Analyze format image"""

header_class: Type[AnalyzeHeader] = AnalyzeHeader
header_class: type[AnalyzeHeader] = AnalyzeHeader
header: AnalyzeHeader
_meta_sniff_len = header_class.sizeof_hdr
files_types: tuple[tuple[str, str], ...] = (('image', '.img'), ('header', '.hdr'))
Expand Down
3 changes: 1 addition & 2 deletions nibabel/filebasedimages.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import io
import typing as ty
from copy import deepcopy
from typing import Type
from urllib import request

from ._compression import COMPRESSION_ERRORS
Expand Down Expand Up @@ -158,7 +157,7 @@ class FileBasedImage:
work.
"""

header_class: Type[FileBasedHeader] = FileBasedHeader
header_class: type[FileBasedHeader] = FileBasedHeader
_meta_sniff_len: int = 0
files_types: tuple[ExtensionSpec, ...] = (('image', None),)
valid_exts: tuple[str, ...] = ()
Expand Down
3 changes: 1 addition & 2 deletions nibabel/minc1.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from __future__ import annotations

from numbers import Integral
from typing import Type

import numpy as np

Expand Down Expand Up @@ -307,7 +306,7 @@ class Minc1Image(SpatialImage):
load.
"""

header_class: Type[MincHeader] = Minc1Header
header_class: type[MincHeader] = Minc1Header
header: MincHeader
_meta_sniff_len: int = 4
valid_exts: tuple[str, ...] = ('.mnc',)
Expand Down
5 changes: 2 additions & 3 deletions nibabel/nifti1.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import warnings
from io import BytesIO
from typing import Type

import numpy as np
import numpy.linalg as npl
Expand Down Expand Up @@ -90,8 +89,8 @@
# datatypes not in analyze format, with codes
if have_binary128():
# Only enable 128 bit floats if we really have IEEE binary 128 longdoubles
_float128t: Type[np.generic] = np.longdouble
_complex256t: Type[np.generic] = np.longcomplex
_float128t: type[np.generic] = np.longdouble
_complex256t: type[np.generic] = np.longcomplex
else:
_float128t = np.void
_complex256t = np.void
Expand Down

0 comments on commit 9f189c6

Please sign in to comment.