Skip to content

Commit 08c182c

Browse files
authored
Merge pull request #923 from mgxd/sty/ruff-0.9.0
STY: Format + add git blame ignore file
2 parents 7337fb1 + 5536e4f commit 08c182c

File tree

12 files changed

+23
-26
lines changed

12 files changed

+23
-26
lines changed

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# 2025-01-09 - [email protected] - STY: Ruff format [git-blame-ignore-rev]
2+
75136b2bb86426c22609449b3f48579ee9c2e4f5

niworkflows/interfaces/bids.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ def _run_interface(self, runtime):
774774
_copy_any(in_file, out_file)
775775

776776
if self.inputs.metadata:
777-
sidecar = out_file.parent / f"{out_file.name.split('.', 1)[0]}.json"
777+
sidecar = out_file.parent / f'{out_file.name.split(".", 1)[0]}.json'
778778
sidecar.unlink(missing_ok=True)
779779
sidecar.write_text(dumps(self.inputs.metadata, indent=2))
780780
self._results['out_meta'].append(str(sidecar))
@@ -1237,7 +1237,7 @@ def _run_interface(self, runtime):
12371237
{k: getattr(self.inputs, k) for k in meta_fields if k not in self._static_traits}
12381238
)
12391239
if self._metadata:
1240-
sidecar = out_file.parent / f"{out_file.name.split('.', 1)[0]}.json"
1240+
sidecar = out_file.parent / f'{out_file.name.split(".", 1)[0]}.json'
12411241
unlink(sidecar, missing_ok=True)
12421242
sidecar.write_text(dumps(self._metadata, sort_keys=True, indent=2))
12431243
self._results['out_meta'] = str(sidecar)
@@ -1483,6 +1483,6 @@ def _fmt_xyz(coords: list) -> str:
14831483
return f'{xyz} mm^3'
14841484

14851485
return (
1486-
f"Template {space} ({_fmt_xyz(res_meta['zooms'])}),"
1487-
f" curated by TemplateFlow {tf.__version__}"
1486+
f'Template {space} ({_fmt_xyz(res_meta["zooms"])}),'
1487+
f' curated by TemplateFlow {tf.__version__}'
14881488
)

niworkflows/interfaces/confounds.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,7 @@ class _SpikeRegressorsInputSpec(BaseInterfaceInputSpec):
176176
concatenate = traits.Bool(
177177
True,
178178
usedefault=True,
179-
desc='Indicates whether to concatenate spikes to existing confounds '
180-
'or return spikes only',
179+
desc='Indicates whether to concatenate spikes to existing confounds or return spikes only',
181180
)
182181
output_format = traits.Enum(
183182
'spikes', 'mask', usedefault=True, desc='Format of output (spikes or mask)'

niworkflows/interfaces/images.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -702,8 +702,7 @@ def _run_interface(self, runtime):
702702
# This check assumes all input masks have same dimensions
703703
if img.shape[:3] != mask_imgs[0].shape[:3]:
704704
raise NotImplementedError(
705-
'Input image and mask should be of '
706-
'same dimensions before running SignalExtraction'
705+
'Input image and mask should be of same dimensions before running SignalExtraction'
707706
)
708707
# Load the mask.
709708
# If mask is a list, each mask is treated as its own ROI/parcel

niworkflows/interfaces/itk.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ class _MultiApplyTransformsInputSpec(_FixTraitApplyTransformsInputSpec):
9191
input_image = InputMultiObject(
9292
File(exists=True),
9393
mandatory=True,
94-
desc='input time-series as a list of volumes after splitting'
95-
' through the fourth dimension',
94+
desc='input time-series as a list of volumes after splitting through the fourth dimension',
9695
)
9796
num_threads = traits.Int(1, usedefault=True, nohash=True, desc='number of parallel processes')
9897
save_cmd = traits.Bool(

niworkflows/interfaces/nibabel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def _run_interface(self, runtime):
182182
img = nb.load(in_file)
183183
extra_dims = tuple(dim for dim in img.shape[3:] if dim > 1) or (1,)
184184
if len(extra_dims) != 1:
185-
raise ValueError(f"Invalid shape {'x'.join(str(s) for s in img.shape)}")
185+
raise ValueError(f'Invalid shape {"x".join(str(s) for s in img.shape)}')
186186
img = img.__class__(
187187
img.dataobj.reshape(img.shape[:3] + extra_dims), img.affine, img.header
188188
)

niworkflows/interfaces/surf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def _run_interface(self, runtime):
192192
in_file = Path(self.inputs.in_file)
193193
extension = ''.join(in_file.suffixes[-((in_file.suffixes[-1] == '.gz') + 1) :])
194194
info = self._pattern.match(in_file.name[: -len(extension)]).groupdict()
195-
self._results['extension'] = f"{info.pop('extprefix', None) or ''}{extension}"
195+
self._results['extension'] = f'{info.pop("extprefix", None) or ""}{extension}'
196196
self._results.update(info)
197197
if 'hemi' in self._results:
198198
self._results['hemi'] = self._results['hemi'].upper()

niworkflows/interfaces/workbench.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ class MetricDilateInputSpec(OpenMPTraitedSpec):
114114
argstr='-exponent %f ',
115115
position=9,
116116
default=6.0,
117-
desc='exponent n to use in (area / (distance ^ n)) as the '
118-
'weighting function (default 6)',
117+
desc='exponent n to use in (area / (distance ^ n)) as the weighting function (default 6)',
119118
)
120119

121120
corrected_areas = File(

niworkflows/tests/test_utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,5 @@ def test_compression(tmp_path):
8989
size = int(os.stat(uncompressed).st_size)
9090
size_compress = int(os.stat(compressed).st_size)
9191
assert size >= size_compress, (
92-
f'The uncompressed report is smaller ({size})'
93-
f'than the compressed report ({size_compress})'
92+
f'The uncompressed report is smaller ({size})than the compressed report ({size_compress})'
9493
)

niworkflows/tests/test_viz.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ def test_carpetplot(tr, sorting):
5454
output_file=(
5555
os.path.join(
5656
save_artifacts,
57-
f"carpet_nosegs_{'index' if tr is None else 'time'}_"
58-
f"{'nosort' if sorting is None else sorting}.svg",
57+
f'carpet_nosegs_{"index" if tr is None else "time"}_'
58+
f'{"nosort" if sorting is None else sorting}.svg',
5959
)
6060
if save_artifacts
6161
else None
@@ -87,8 +87,8 @@ def test_carpetplot(tr, sorting):
8787
output_file=(
8888
os.path.join(
8989
save_artifacts,
90-
f"carpet_random_{'index' if tr is None else 'seg'}_"
91-
f"{'nosort' if sorting is None else sorting}.svg",
90+
f'carpet_random_{"index" if tr is None else "seg"}_'
91+
f'{"nosort" if sorting is None else sorting}.svg',
9292
)
9393
if save_artifacts
9494
else None
@@ -114,8 +114,8 @@ def test_carpetplot(tr, sorting):
114114
output_file=(
115115
os.path.join(
116116
save_artifacts,
117-
f"carpet_const_{'index' if tr is None else 'time'}_"
118-
f"{'nosort' if sorting is None else sorting}.svg",
117+
f'carpet_const_{"index" if tr is None else "time"}_'
118+
f'{"nosort" if sorting is None else sorting}.svg',
119119
)
120120
if save_artifacts
121121
else None

0 commit comments

Comments
 (0)