From c842d84248ae4d5021d2ed9366414093603e20e6 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Tue, 8 Oct 2024 08:44:07 +0200 Subject: [PATCH] STY: Apply ruff preview rule RUF031 RUF031 Avoid parentheses for tuples in subscripts. --- nibabel/minc1.py | 2 +- nibabel/nicom/csareader.py | 2 +- nibabel/nicom/tests/test_csareader.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nibabel/minc1.py b/nibabel/minc1.py index d0b9fd537..2d44736a2 100644 --- a/nibabel/minc1.py +++ b/nibabel/minc1.py @@ -80,7 +80,7 @@ def get_data_dtype(self): dtt = np.dtype(np.float64) else: signtype = self._image.signtype.decode('latin-1') - dtt = _dt_dict[(typecode, signtype)] + dtt = _dt_dict[typecode, signtype] return np.dtype(dtt).newbyteorder('>') def get_data_shape(self): diff --git a/nibabel/nicom/csareader.py b/nibabel/nicom/csareader.py index b98dae740..4982be834 100644 --- a/nibabel/nicom/csareader.py +++ b/nibabel/nicom/csareader.py @@ -63,7 +63,7 @@ def get_csa_header(dcm_data, csa_type='image'): return None element_no = section_start + element_offset try: - tag = dcm_data[(0x29, element_no)] + tag = dcm_data[0x29, element_no] except KeyError: # The element could be missing due to anonymization return None diff --git a/nibabel/nicom/tests/test_csareader.py b/nibabel/nicom/tests/test_csareader.py index f31f4a393..f43bf4ba2 100644 --- a/nibabel/nicom/tests/test_csareader.py +++ b/nibabel/nicom/tests/test_csareader.py @@ -35,7 +35,7 @@ def test_csa_header_read(): data2.add(element) assert csa.get_csa_header(data2, 'image') is None # Add back the marker - CSA works again - data2[(0x29, 0x10)] = DATA[(0x29, 0x10)] + data2[0x29, 0x10] = DATA[0x29, 0x10] assert csa.is_mosaic(csa.get_csa_header(data2, 'image'))