From 35124b7f45604d54fe90753c1f7119bddf9eb997 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 22 Sep 2024 16:10:42 +0200 Subject: [PATCH 1/3] STY: Apply ruff/pygrep-hooks rule PGH004 PGH004 Do not add spaces between `noqa` and its colon --- nibabel/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nibabel/conftest.py b/nibabel/conftest.py index a4f8b6de9..b16a832f2 100644 --- a/nibabel/conftest.py +++ b/nibabel/conftest.py @@ -5,7 +5,7 @@ # Ignore warning requesting help with nicom with pytest.warns(UserWarning): - import nibabel.nicom # noqa :401 + import nibabel.nicom # noqa: F401 @pytest.fixture(scope='session', autouse=True) From f31bf2b95f975e5e03e5e50f88b0c65225f733e0 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 22 Sep 2024 16:12:51 +0200 Subject: [PATCH 2/3] STY: Apply ruff/pygrep-hooks rule PGH004 PGH004 Use specific rule codes when using `noqa` --- nibabel/benchmarks/bench_array_to_file.py | 4 ++-- nibabel/benchmarks/bench_finite_range.py | 2 +- nibabel/xmlutils.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nibabel/benchmarks/bench_array_to_file.py b/nibabel/benchmarks/bench_array_to_file.py index c2bab7e95..2af8b5677 100644 --- a/nibabel/benchmarks/bench_array_to_file.py +++ b/nibabel/benchmarks/bench_array_to_file.py @@ -11,12 +11,12 @@ """ import sys -from io import BytesIO # NOQA +from io import BytesIO # noqa: F401 import numpy as np from numpy.testing import measure -from nibabel.volumeutils import array_to_file # NOQA +from nibabel.volumeutils import array_to_file # noqa: F401 from .butils import print_git_title diff --git a/nibabel/benchmarks/bench_finite_range.py b/nibabel/benchmarks/bench_finite_range.py index edd839ce6..957446884 100644 --- a/nibabel/benchmarks/bench_finite_range.py +++ b/nibabel/benchmarks/bench_finite_range.py @@ -15,7 +15,7 @@ import numpy as np from numpy.testing import measure -from nibabel.volumeutils import finite_range # NOQA +from nibabel.volumeutils import finite_range # noqa: F401 from .butils import print_git_title diff --git a/nibabel/xmlutils.py b/nibabel/xmlutils.py index 5d079e117..12fd30f22 100644 --- a/nibabel/xmlutils.py +++ b/nibabel/xmlutils.py @@ -9,7 +9,7 @@ """Thin layer around xml.etree.ElementTree, to abstract nibabel xml support""" from io import BytesIO -from xml.etree.ElementTree import Element, SubElement, tostring # noqa +from xml.etree.ElementTree import Element, SubElement, tostring # noqa: F401 from xml.parsers.expat import ParserCreate from .filebasedimages import FileBasedHeader From aea7fe7be420deaa8c93ea8d7711c7a77214eb92 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 22 Sep 2024 22:53:46 +0200 Subject: [PATCH 3/3] STY: Enforce ruff/pygrep-hooks rules (PGH) --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 748dc12ce..e865cd009 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -124,6 +124,7 @@ select = [ "FURB", "I", "PERF", + "PGH", "PIE", "PLE", "PT",