Skip to content

Commit c53326c

Browse files
committed
chore: Rerun ruff with python >=3.10
1 parent c1951d7 commit c53326c

File tree

8 files changed

+24
-12
lines changed

8 files changed

+24
-12
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ ignore = [
193193
"B019",
194194
"SIM108",
195195
"C901",
196+
"UP038",
196197
]
197198

198199
[tool.ruff.lint.flake8-quotes]

sdcflows/interfaces/epi.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,15 @@ def _run_interface(self, runtime):
120120
blips,
121121
self.inputs.readout_times,
122122
self.inputs.in_data,
123+
strict=False,
123124
)
124125
)
125126

126127
(
127128
self._results['pe_dirs_fsl'],
128129
self._results['readout_times'],
129130
self._results['out_data'],
130-
) = zip(*sorted_inputs)
131+
) = zip(*sorted_inputs, strict=False)
131132

132133
# Put sign back last
133134
self._results['pe_dirs_fsl'] = [

sdcflows/interfaces/fmap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ def _run_interface(self, runtime):
289289
fmap_imgs = [nb.load(fname) for fname in fmap_files]
290290

291291
# Baseline check: paired magnitude/phase maps are basically the same
292-
for mag, fmap in zip(mag_imgs, fmap_imgs):
292+
for mag, fmap in zip(mag_imgs, fmap_imgs, strict=False):
293293
msg = _check_gross_geometry(mag, fmap)
294294
if msg is not None:
295295
LOGGER.critical(msg)

sdcflows/interfaces/utils.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,15 @@ class Flatten(SimpleInterface):
8181

8282
def _run_interface(self, runtime):
8383
self._results['out_list'] = _flatten(
84-
zip(self.inputs.in_data, self.inputs.in_meta),
84+
zip(self.inputs.in_data, self.inputs.in_meta, strict=False),
8585
max_trs=self.inputs.max_trs,
8686
out_dir=runtime.cwd,
8787
)
8888

8989
# Unzip out_data, out_meta outputs.
90-
self._results['out_data'], self._results['out_meta'] = zip(*self._results['out_list'])
90+
self._results['out_data'], self._results['out_meta'] = zip(
91+
*self._results['out_list'], strict=False
92+
)
9193
return runtime
9294

9395

@@ -449,7 +451,11 @@ def _deoblique(in_file, in_affine=None, newpath=None):
449451
if in_affine is None:
450452
orientation = nb.aff2axcodes(nii.affine)
451453
directions = (
452-
np.array([int(l1 == l2) for l1, l2 in zip(orientation, 'RAS')], dtype='float32') * 2
454+
np.array(
455+
[int(l1 == l2) for l1, l2 in zip(orientation, 'RAS', strict=False)],
456+
dtype='float32',
457+
)
458+
* 2
453459
- 1
454460
)
455461
newaff = np.eye(4)

sdcflows/tests/test_transform.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def generate_oracle(
4848
data[19:22, ...] = 0
4949
data = np.pad(data + nd.binary_erosion(data, ball(3)), 8)
5050

51-
zooms = [z if not f else -z for z, f in zip(zooms, flip)]
51+
zooms = [z if not f else -z for z, f in zip(zooms, flip, strict=False)]
5252
affine = np.diag(zooms + [1])
5353
affine[:3, 3] = -affine[:3, :3] @ ((np.array(data.shape) - 1) * 0.5)
5454

@@ -123,7 +123,9 @@ def test_displacements_field(tmpdir, testdata_dir, outdir, pe_dir, rotation, fli
123123
assert np.all((np.sqrt(((ours - theirs) ** 2).sum()) / ours.size) < 1e-1)
124124

125125
if outdir:
126-
orientation = ''.join([ax[bool(f)] for ax, f in zip(('RL', 'AP', 'SI'), flip)])
126+
orientation = ''.join(
127+
[ax[bool(f)] for ax, f in zip(('RL', 'AP', 'SI'), flip, strict=False)]
128+
)
127129

128130
SimpleBeforeAfter(
129131
after_label='Theirs (ANTs)',

sdcflows/transform.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,9 @@
4949

5050
import asyncio
5151
import os
52-
from collections.abc import Sequence
52+
from collections.abc import Callable, Sequence
5353
from functools import partial
5454
from pathlib import Path
55-
from typing import Callable
5655
from warnings import warn
5756

5857
import attr
@@ -492,7 +491,7 @@ def apply(
492491
ro_time *= n_volumes
493492

494493
pe_info = []
495-
for vol_pe_dir, vol_ro_time in zip(pe_dir, ro_time):
494+
for vol_pe_dir, vol_ro_time in zip(pe_dir, ro_time, strict=False):
496495
pe_axis = 'ijk'.index(vol_pe_dir[0])
497496
# Displacements are reversed if either is true (after ensuring positive cosines)
498497
flip = (axcodes[pe_axis] in 'LPI') ^ vol_pe_dir.endswith('-')

sdcflows/utils/wrangler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ def find_estimators(
488488
targets = all_targets
489489
intent_map = [[target] for target in all_targets]
490490

491-
for target, intent in zip(targets, intent_map):
491+
for target, intent in zip(targets, intent_map, strict=False):
492492
logger.debug('Found single PE target %s', target.relpath)
493493
# The new estimator is IntendedFor the individual targets,
494494
# even if the EPI file is IntendedFor multiple

sdcflows/workflows/fit/tests/test_syn.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,10 @@ def test_mm2vox(tmp_path, fixed_ornt, moving_ornt, ijk, index):
304304

305305
vox_params = _mm2vox(str(moving_path), str(fixed_path), ijk, config)
306306
vox_values = [level[2] for level in vox_params]
307-
assert [mm_level[:2] == vox_level[:2] for mm_level, vox_level in zip(params, vox_params)]
307+
assert [
308+
mm_level[:2] == vox_level[:2]
309+
for mm_level, vox_level in zip(params, vox_params, strict=False)
310+
]
308311
assert np.array_equal(vox_values, mm_values / [2, 3, 4][index])
309312

310313

0 commit comments

Comments
 (0)