From 7af724bf5294257b315424297f0c9154259aaf92 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 22 Sep 2024 16:52:04 +0200 Subject: [PATCH 1/3] STY: Apply ruff/flake8-pie rule PIE807 PIE807 Prefer `list` over useless lambda --- nibabel/streamlines/tests/test_tractogram.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nibabel/streamlines/tests/test_tractogram.py b/nibabel/streamlines/tests/test_tractogram.py index 915968854..72b84fac6 100644 --- a/nibabel/streamlines/tests/test_tractogram.py +++ b/nibabel/streamlines/tests/test_tractogram.py @@ -49,8 +49,8 @@ def make_fake_tractogram( ): """Make multiple streamlines according to provided requirements.""" all_streamlines = [] - all_data_per_point = defaultdict(lambda: []) - all_data_per_streamline = defaultdict(lambda: []) + all_data_per_point = defaultdict(list) + all_data_per_streamline = defaultdict(list) for nb_points in list_nb_points: data = make_fake_streamline( nb_points, data_per_point_shapes, data_for_streamline_shapes, rng From b4fb300525adacf7167b07ccf89a04232e72c866 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 22 Sep 2024 16:52:54 +0200 Subject: [PATCH 2/3] STY: Apply ruff/flake8-pie rule PIE808 PIE808 Unnecessary `start` argument in `range` --- nibabel/ecat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nibabel/ecat.py b/nibabel/ecat.py index 34ff06323..c4b55624f 100644 --- a/nibabel/ecat.py +++ b/nibabel/ecat.py @@ -957,7 +957,7 @@ def to_file_map(self, file_map=None): hdr.write_to(hdrf) # Write every frames - for index in range(0, self.header['num_frames']): + for index in range(self.header['num_frames']): # Move to subheader offset frame_offset = subheaders._get_frame_offset(index) - 512 imgf.seek(frame_offset) From 576b74bd1ef5d0373cfe5d17bc8ce06f366bc9c0 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 22 Sep 2024 17:39:54 +0200 Subject: [PATCH 3/3] STY: Enforce ruff/flake8-pie rules (PIE) --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index becc93366..7f416c13a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -120,6 +120,7 @@ select = [ "C4", "F", "I", + "PIE", "PLE", "Q", "RSE", @@ -139,6 +140,7 @@ ignore = [ "C401", "C408", "C416", + "PIE790", # https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules "W191", "E111",