Skip to content

Commit 3927e5b

Browse files
authored
Merge pull request #918 from DimitriPapadopoulos/FURB
STY: Apply ruff/refurb rules (FURB)
2 parents 2d166c6 + 1f432a7 commit 3927e5b

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

niworkflows/engine/tests/test_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from ..plugin import MultiProcPlugin
99

1010

11-
def add(x, y):
11+
def add(x, y): # noqa: FURB118 # the Function interface does not support builtin functions
1212
return x + y
1313

1414

niworkflows/reports/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def __init__(
285285
self.packagename = packagename
286286
self.subject_id = subject_id
287287
if subject_id is not None:
288-
self.subject_id = subject_id[4:] if subject_id.startswith('sub-') else subject_id
288+
self.subject_id = subject_id.removeprefix('sub-')
289289
self.out_filename = f'sub-{self.subject_id}.html'
290290

291291
# Default template from niworkflows

niworkflows/utils/bids.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def collect_participants(bids_dir, participant_label=None, strict=False, bids_va
134134
participant_label = [participant_label]
135135

136136
# Drop sub- prefixes
137-
participant_label = [sub[4:] if sub.startswith('sub-') else sub for sub in participant_label]
137+
participant_label = [sub.removeprefix('sub-') for sub in participant_label]
138138
# Remove duplicates
139139
participant_label = sorted(set(participant_label))
140140
# Remove labels not found

niworkflows/utils/tests/test_utils.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,13 @@ def test_clean_symlink(tmp_path):
8383

8484

8585
def _gen_skeleton(root):
86-
dirs, files = [], []
87-
files.append(root / 'file1')
88-
files.append(root / '.file2')
89-
dirs.append(root / 'subdir1')
90-
files.append(dirs[0] / 'file3')
91-
files.append(dirs[0] / '.file4')
86+
dirs = [root / 'subdir1']
87+
files = [
88+
root / 'file1',
89+
root / '.file2',
90+
dirs[0] / 'file3',
91+
dirs[0] / '.file4',
92+
]
9293
for d in dirs:
9394
d.mkdir()
9495
for f in files:

0 commit comments

Comments
 (0)