File tree Expand file tree Collapse file tree 9 files changed +28
-14
lines changed Expand file tree Collapse file tree 9 files changed +28
-14
lines changed Original file line number Diff line number Diff line change 12
12
13
13
import bz2
14
14
import gzip
15
- import io
16
15
import typing as ty
17
16
18
17
from .optpkg import optional_package
19
18
20
19
if ty .TYPE_CHECKING :
20
+ import io
21
+
21
22
import indexed_gzip # type: ignore[import]
22
23
import pyzstd
23
24
Original file line number Diff line number Diff line change 14
14
15
15
import numpy as np
16
16
17
- from .arrayproxy import ArrayLike
18
17
from .deprecated import deprecate_with_version
19
18
from .filebasedimages import FileBasedHeader , FileBasedImage
20
- from .fileholders import FileMap
21
19
22
20
if ty .TYPE_CHECKING :
23
21
import numpy .typing as npt
24
22
23
+ from .arrayproxy import ArrayLike
24
+ from .fileholders import FileMap
25
25
from .filename_parser import FileSpec
26
26
27
27
ArrayImgT = ty .TypeVar ('ArrayImgT' , bound = 'DataobjImage' )
Original file line number Diff line number Diff line change 10
10
11
11
from __future__ import annotations
12
12
13
- import io
14
13
import typing as ty
15
14
from copy import copy
16
15
17
16
from .openers import ImageOpener
18
17
18
+ if ty .TYPE_CHECKING :
19
+ import io
20
+
19
21
20
22
class FileHolderError (Exception ):
21
23
pass
Original file line number Diff line number Diff line change 10
10
11
11
from __future__ import annotations
12
12
13
+ from typing import TYPE_CHECKING
14
+
13
15
from .analyze import AnalyzeImage
14
16
from .brikhead import AFNIImage
15
17
from .cifti2 import Cifti2Image
16
- from .dataobj_images import DataobjImage
17
- from .filebasedimages import FileBasedImage
18
18
from .freesurfer import MGHImage
19
19
from .gifti import GiftiImage
20
20
from .minc1 import Minc1Image
25
25
from .spm2analyze import Spm2AnalyzeImage
26
26
from .spm99analyze import Spm99AnalyzeImage
27
27
28
+ if TYPE_CHECKING :
29
+ from .dataobj_images import DataobjImage
30
+ from .filebasedimages import FileBasedImage
31
+
28
32
# Ordered by the load/save priority.
29
33
all_image_classes : list [type [FileBasedImage ]] = [
30
34
Nifti1Pair ,
Original file line number Diff line number Diff line change 3
3
from __future__ import annotations
4
4
5
5
import typing as ty
6
- from types import ModuleType
7
6
8
7
from packaging .version import Version
9
8
10
9
from .tripwire import TripWire
11
10
11
+ if ty .TYPE_CHECKING :
12
+ from types import ModuleType
13
+
12
14
13
15
def _check_pkg_version (min_version : str | Version ) -> ty .Callable [[ModuleType ], bool ]:
14
16
min_ver = Version (min_version ) if isinstance (min_version , str ) else min_version
Original file line number Diff line number Diff line change 132
132
133
133
from __future__ import annotations
134
134
135
- import io
136
135
import typing as ty
137
- from collections .abc import Sequence
138
136
from typing import Literal
139
137
140
138
import numpy as np
141
139
142
- from .arrayproxy import ArrayLike
143
140
from .casting import sctypes_aliases
144
141
from .dataobj_images import DataobjImage
145
142
from .filebasedimages import FileBasedHeader , FileBasedImage
146
- from .fileholders import FileMap
147
143
from .fileslice import canonical_slicers
148
144
from .orientations import apply_orientation , inv_ornt_aff
149
145
from .viewers import OrthoSlicer3D
155
151
from functools import lru_cache as cache
156
152
157
153
if ty .TYPE_CHECKING :
154
+ import io
155
+ from collections .abc import Sequence
156
+
158
157
import numpy .typing as npt
159
158
159
+ from .arrayproxy import ArrayLike
160
+ from .fileholders import FileMap
161
+
160
162
SpatialImgT = ty .TypeVar ('SpatialImgT' , bound = 'SpatialImage' )
161
163
SpatialHdrT = ty .TypeVar ('SpatialHdrT' , bound = 'SpatialHeader' )
162
164
Original file line number Diff line number Diff line change 26
26
from .helpers import assert_data_similar , bytesio_filemap , bytesio_round_trip
27
27
from .np_features import memmap_after_ufunc
28
28
29
+ if ty .TYPE_CHECKING :
30
+ from importlib .resources .abc import Traversable
31
+
29
32
try :
30
33
from importlib .resources import as_file , files
31
- from importlib .resources .abc import Traversable
32
34
except ImportError : # PY38
33
35
from importlib_resources import as_file , files
34
- from importlib_resources .abc import Traversable
35
36
36
37
37
38
def get_test_data (
Original file line number Diff line number Diff line change 10
10
11
11
from __future__ import annotations
12
12
13
- import io
14
13
import sys
15
14
import typing as ty
16
15
import warnings
25
24
from .externals .oset import OrderedSet
26
25
27
26
if ty .TYPE_CHECKING :
27
+ import io
28
+
28
29
import numpy .typing as npt
29
30
30
31
Scalar = np .number | float
Original file line number Diff line number Diff line change @@ -123,6 +123,7 @@ select = [
123
123
" PLE" ,
124
124
" Q" ,
125
125
" RSE" ,
126
+ " TCH" ,
126
127
" UP" ,
127
128
]
128
129
ignore = [
You can’t perform that action at this time.
0 commit comments