Skip to content

Commit

Permalink
STY: Apply ruff/refurb rule FURB188
Browse files Browse the repository at this point in the history
FURB188 Prefer `removeprefix` over conditionally replacing with slice.
  • Loading branch information
DimitriPapadopoulos committed Dec 21, 2024
1 parent c4a9022 commit 9024760
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion niworkflows/reports/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def __init__(
self.packagename = packagename
self.subject_id = subject_id
if subject_id is not None:
self.subject_id = subject_id[4:] if subject_id.startswith('sub-') else subject_id
self.subject_id = subject_id.removeprefix('sub-')

Check warning on line 288 in niworkflows/reports/core.py

View check run for this annotation

Codecov / codecov/patch

niworkflows/reports/core.py#L288

Added line #L288 was not covered by tests
self.out_filename = f'sub-{self.subject_id}.html'

# Default template from niworkflows
Expand Down
2 changes: 1 addition & 1 deletion niworkflows/utils/bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def collect_participants(bids_dir, participant_label=None, strict=False, bids_va
participant_label = [participant_label]

# Drop sub- prefixes
participant_label = [sub[4:] if sub.startswith('sub-') else sub for sub in participant_label]
participant_label = [sub.removeprefix('sub-') for sub in participant_label]

Check warning on line 137 in niworkflows/utils/bids.py

View check run for this annotation

Codecov / codecov/patch

niworkflows/utils/bids.py#L137

Added line #L137 was not covered by tests
# Remove duplicates
participant_label = sorted(set(participant_label))
# Remove labels not found
Expand Down

0 comments on commit 9024760

Please sign in to comment.