Skip to content

Commit 29b3a88

Browse files
STY: Apply ruff/refurb rule FURB188
FURB188 Prefer `removeprefix` over conditionally replacing with slice.
1 parent 8d24e60 commit 29b3a88

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

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

0 commit comments

Comments
 (0)