Skip to content

Commit 4098598

Browse files
authored
Merge pull request #1288 from DimitriPapadopoulos/repo-review
MNT: Apply Repo-Review suggestions
2 parents f7b9bc4 + 1ec8488 commit 4098598

File tree

11 files changed

+14
-12
lines changed

11 files changed

+14
-12
lines changed

nibabel/_compression.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from .optpkg import optional_package
1818

1919
if ty.TYPE_CHECKING: # pragma: no cover
20-
import indexed_gzip # type: ignore
20+
import indexed_gzip # type: ignore[import-not-found]
2121
import pyzstd
2222

2323
HAVE_INDEXED_GZIP = True
@@ -40,7 +40,7 @@
4040
if HAVE_INDEXED_GZIP:
4141
COMPRESSED_FILE_LIKES += (indexed_gzip.IndexedGzipFile,)
4242
COMPRESSION_ERRORS += (indexed_gzip.ZranError,)
43-
from indexed_gzip import IndexedGzipFile # type: ignore
43+
from indexed_gzip import IndexedGzipFile # type: ignore[import-not-found]
4444
else:
4545
IndexedGzipFile = gzip.GzipFile
4646

nibabel/benchmarks/bench_arrayproxy_slicing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
# if memory_profiler is installed, we get memory usage results
2828
try:
29-
from memory_profiler import memory_usage # type: ignore
29+
from memory_profiler import memory_usage # type: ignore[import-not-found]
3030
except ImportError:
3131
memory_usage = None
3232

nibabel/cmdline/dicomfs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class dummy_fuse:
2525

2626

2727
try:
28-
import fuse # type: ignore
28+
import fuse # type: ignore[import-not-found]
2929

3030
uid = os.getuid()
3131
gid = os.getgid()

nibabel/externals/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import os
77
from contextlib import contextmanager
88

9-
@contextmanager # type: ignore
9+
@contextmanager # type: ignore[no-redef]
1010
def _chdir(path):
1111
cwd = os.getcwd()
1212
os.chdir(path)

nibabel/minc2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class Minc2Image(Minc1Image):
163163
def from_file_map(klass, file_map, *, mmap=True, keep_file_open=None):
164164
# Import of h5py might take awhile for MPI-enabled builds
165165
# So we are importing it here "on demand"
166-
import h5py # type: ignore
166+
import h5py # type: ignore[import-not-found]
167167

168168
holder = file_map['image']
169169
if holder.filename is None:

nibabel/parrec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,7 @@ def from_filename(
13381338
strict_sort=strict_sort,
13391339
)
13401340

1341-
load = from_filename # type: ignore
1341+
load = from_filename # type: ignore[assignment]
13421342

13431343

13441344
load = PARRECImage.from_filename

nibabel/pydicom_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
if have_dicom:
4444
# Values not imported by default
45-
import pydicom.values # type: ignore
45+
import pydicom.values # type: ignore[import-not-found]
4646
from pydicom.dicomio import dcmread as read_file # noqa:F401
4747
from pydicom.sequence import Sequence # noqa:F401
4848

nibabel/spm99analyze.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def from_file_map(klass, file_map, *, mmap=True, keep_file_open=None):
275275
contents = matf.read()
276276
if len(contents) == 0:
277277
return ret
278-
import scipy.io as sio # type: ignore
278+
import scipy.io as sio # type: ignore[import-not-found]
279279

280280
mats = sio.loadmat(BytesIO(contents))
281281
if 'mat' in mats: # this overrides a 'M', and includes any flip

nibabel/tmpdirs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from contextlib import chdir as _chdir
1616
except ImportError: # PY310
1717

18-
@contextmanager # type: ignore
18+
@contextmanager # type: ignore[no-redef]
1919
def _chdir(path):
2020
cwd = os.getcwd()
2121
os.chdir(path)

nibabel/xmlutils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def to_xml(self, enc='utf-8', **kwargs) -> bytes:
3232
Additional keyword arguments to :func:`xml.etree.ElementTree.tostring`.
3333
"""
3434
ele = self._to_xml_element()
35-
return b'' if ele is None else tostring(ele, enc, **kwargs)
35+
return tostring(ele, enc, **kwargs)
3636

3737

3838
class XmlBasedHeader(FileBasedHeader, XmlSerializable):

0 commit comments

Comments
 (0)