From 7a23f67eb431330a7aca17a0eca9d4bae7be6d8e Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 22 Sep 2024 17:19:42 +0200 Subject: [PATCH 1/2] STY: Apply ruff/Pylint rule PLE0101 PLE0101 Explicit return in `__init__` --- nibabel/openers.py | 2 +- nibabel/tmpdirs.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nibabel/openers.py b/nibabel/openers.py index c3fa9a478..9a306d4e4 100644 --- a/nibabel/openers.py +++ b/nibabel/openers.py @@ -68,7 +68,7 @@ def __init__( raise TypeError('Must define either fileobj or filename') # Cast because GzipFile.myfileobj has type io.FileIO while open returns ty.IO fileobj = self.myfileobj = ty.cast(io.FileIO, open(filename, modestr)) - return super().__init__( + super().__init__( filename='', mode=modestr, compresslevel=compresslevel, diff --git a/nibabel/tmpdirs.py b/nibabel/tmpdirs.py index 9d67f6acb..2bcf9fdeb 100644 --- a/nibabel/tmpdirs.py +++ b/nibabel/tmpdirs.py @@ -54,7 +54,7 @@ def __init__(self, suffix='', prefix=tempfile.template, dir=None): >>> os.path.exists(tmpdir) False """ - return super().__init__(suffix, prefix, dir) + super().__init__(suffix, prefix, dir) @contextmanager From 747338cd86ea958de1f1b45e7d5d87ebe7d1a222 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 22 Sep 2024 17:53:36 +0200 Subject: [PATCH 2/2] STY: Enforce ruff/Pylint rules, errors only (PLE) --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 2840119c4..915ea9b81 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -118,6 +118,7 @@ exclude = ["doc", "nibabel/externals", "tools", "version.py", "versioneer.py"] select = [ "F", "I", + "PLE", "Q", "UP", ]