From 930cc28a306d211e09228ca1ebef8966586b17e2 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 22 Sep 2024 16:22:45 +0200 Subject: [PATCH 1/2] STY: Apply ruff/flake8-raise rule RSE102 RSE102 Unnecessary parentheses on raised exception --- nibabel/streamlines/tractogram_file.py | 6 +++--- nibabel/tests/test_volumeutils.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nibabel/streamlines/tractogram_file.py b/nibabel/streamlines/tractogram_file.py index 557261e9a..65add3e2f 100644 --- a/nibabel/streamlines/tractogram_file.py +++ b/nibabel/streamlines/tractogram_file.py @@ -74,7 +74,7 @@ def is_correct_format(cls, fileobj): Returns True if `fileobj` is in the right streamlines file format, otherwise returns False. """ - raise NotImplementedError() + raise NotImplementedError @classmethod def create_empty_header(cls): @@ -101,7 +101,7 @@ def load(cls, fileobj, lazy_load=True): Returns an object containing tractogram data and header information. """ - raise NotImplementedError() + raise NotImplementedError @abstractmethod def save(self, fileobj): @@ -113,4 +113,4 @@ def save(self, fileobj): If string, a filename; otherwise an open file-like object opened and ready to write. """ - raise NotImplementedError() + raise NotImplementedError diff --git a/nibabel/tests/test_volumeutils.py b/nibabel/tests/test_volumeutils.py index 07ca9a6ba..9d321f07e 100644 --- a/nibabel/tests/test_volumeutils.py +++ b/nibabel/tests/test_volumeutils.py @@ -989,7 +989,7 @@ def test_seek_tell_logic(): class BabyBio(BytesIO): def seek(self, *args): - raise OSError() + raise OSError bio = BabyBio() # Fresh fileobj, position 0, can't seek - error From 47df196256e67a248abf664d84c681c54f0bd784 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 22 Sep 2024 17:47:06 +0200 Subject: [PATCH 2/2] STY: Enforce ruff/flake8-raise rules (RSE) --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 2840119c4..55e96d992 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -119,6 +119,7 @@ select = [ "F", "I", "Q", + "RSE", "UP", ] ignore = [