8000 MNT: Apply Repo-Review suggestions by DimitriPapadopoulos · Pull Request #1288 · nipy/nibabel · GitHub
[go: up one dir, main page]

Skip to content

MNT: Apply Repo-Review suggestions #1288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
MNT: Apply Repo-Review suggestions
  • Loading branch information
DimitriPapadopoulos committed Dec 25, 2023
commit 1ec84885bc40ea459252fb74e45945f25bd804f1
4 changes: 2 additions & 2 deletions nibabel/_compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from .optpkg import optional_package

if ty.TYPE_CHECKING: # pragma: no cover
import indexed_gzip # type: ignore
import indexed_gzip # type: ignore[import-not-found]
import pyzstd

HAVE_INDEXED_GZIP = True
Expand All @@ -40,7 +40,7 @@
if HAVE_INDEXED_GZIP:
COMPRESSED_FILE_LIKES += (indexed_gzip.IndexedGzipFile,)
COMPRESSION_ERRORS += (indexed_gzip.ZranError,)
from indexed_gzip import IndexedGzipFile # type: ignore
from indexed_gzip import IndexedGzipFile # type: ignore[import-not-found]
else:
IndexedGzipFile = gzip.GzipFile

Expand Down
2 changes: 1 addition & 1 deletion nibabel/benchmarks/bench_arrayproxy_slicing.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

# if memory_profiler is installed, we get memory usage results
try:
from memory_profiler import memory_usage # type: ignore
from memory_profiler import memory_usage # type: ignore[import-not-found]
except ImportError:
memory_usage = None

Expand Down
2 changes: 1 addition & 1 deletion nibabel/cmdline/dicomfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class dummy_fuse:


try:
import fuse # type: ignore
import fuse # type: ignore[import-not-found]

uid = os.getuid()
gid = os.getgid()
Expand Down
2 changes: 1 addition & 1 deletion nibabel/externals/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os
from contextlib import contextmanager

@contextmanager # type: ignore
@contextmanager # type: ignore[no-redef]
def _chdir(path):
cwd = os.getcwd()
os.chdir(path)
Expand Down
2 changes: 1 addition & 1 deletion nibabel/minc2.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class Minc2Image(Minc1Image):
def from_file_map(klass, file_map, *, mmap=True, keep_file_open=None):
# Import of h5py might take awhile for MPI-enabled builds
# So we are importing it here "on demand"
import h5py # type: ignore
import h5py # type: ignore[import-not-found]

holder = file_map['image']
if holder.filename is None:
Expand Down
2 changes: 1 addition & 1 deletion nibabel/parrec.py
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,7 @@ def from_filename(
strict_sort=strict_sort,
)

load = from_filename # type: ignore
load = from_filename # type: ignore[assignment]


load = PARRECImage.from_filename
2 changes: 1 addition & 1 deletion nibabel/pydicom_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

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

Expand Down
2 changes: 1 addition & 1 deletion nibabel/spm99analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def from_file_map(klass, file_map, *, mmap=True, keep_file_open=None):
contents = matf.read()
if len(contents) == 0:
return ret
import scipy.io as sio # type: ignore
import scipy.io as sio # type: ignore[import-not-found]

mats = sio.loadmat(BytesIO(contents))
if 'mat' in mats: # this overrides a 'M', and includes any flip
Expand Down
2 changes: 1 addition & 1 deletion nibabel/tmpdirs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from contextlib import chdir as _chdir
except ImportError: # PY310

@contextmanager # type: ignore
@contextmanager # type: ignore[no-redef]
def _chdir(path):
cwd = os.getcwd()
os.chdir(path)
Expand Down
2 changes: 1 addition & 1 deletion nibabel/xmlutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def to_xml(self, enc='utf-8', **kwargs) -> bytes:
Additional keyword arguments to :func:`xml.etree.ElementTree.tostring`.
"""
ele = self._to_xml_element()
return b'' if ele is None else tostring(ele, enc, **kwargs)
return tostring(ele, enc, **kwargs)


class XmlBasedHeader(FileBasedHeader, XmlSerializable):
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ __version_tuple__ = version_tuple = {version_tuple!r}

[tool.blue]
line_length = 99
target-version = ["py37"]
target-version = ["py38"]
force-exclude = """
(
_version.py
Expand All @@ -130,6 +130,8 @@ python_version = "3.11"
exclude = [
"/tests",
]
warn_unreachable = true
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]

[tool.codespell]
skip = "*/data/*,./nibabel-data"
Expand Down
0