From 8164f9d78daaef886be8e23947b005774c1c7d39 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Tue, 1 Oct 2024 19:00:30 +0200 Subject: [PATCH] STY: Apply ruff/flake8-comprehensions preview rule C419 C419 Unnecessary list comprehension --- nibabel/orientations.py | 2 +- nibabel/tests/test_volumeutils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nibabel/orientations.py b/nibabel/orientations.py index 12e414def..b620fff02 100644 --- a/nibabel/orientations.py +++ b/nibabel/orientations.py @@ -322,7 +322,7 @@ def axcodes2ornt(axcodes, labels=None): [ 2., 1.]]) """ labels = list(zip('LPI', 'RAS')) if labels is None else labels - allowed_labels = sum([list(L) for L in labels], []) + [None] + allowed_labels = sum((list(L) for L in labels), []) + [None] if len(allowed_labels) != len(set(allowed_labels)): raise ValueError(f'Duplicate labels in {allowed_labels}') if not set(axcodes).issubset(allowed_labels): diff --git a/nibabel/tests/test_volumeutils.py b/nibabel/tests/test_volumeutils.py index 9d321f07e..1bd44cbd0 100644 --- a/nibabel/tests/test_volumeutils.py +++ b/nibabel/tests/test_volumeutils.py @@ -607,7 +607,7 @@ def test_a2f_nanpos(): def test_a2f_bad_scaling(): # Test that pathological scalers raise an error - NUMERICAL_TYPES = sum([sctypes[key] for key in ['int', 'uint', 'float', 'complex']], []) + NUMERICAL_TYPES = sum((sctypes[key] for key in ['int', 'uint', 'float', 'complex']), []) for in_type, out_type, slope, inter in itertools.product( NUMERICAL_TYPES, NUMERICAL_TYPES,