Skip to content

Commit

Permalink
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 Nov 23, 2024
1 parent fe1c3f1 commit 92ff3be
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions nireports/assembler/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,15 +255,11 @@ def __init__(

if bids_filters.get("subject"):
subject_id = bids_filters["subject"]
bids_filters["subject"] = (
subject_id[4:] if subject_id.startswith("sub-") else subject_id
)
bids_filters["subject"] = subject_id.removeprefix("sub-")

if bids_filters.get("session"):
session_id = bids_filters["session"]
bids_filters["session"] = (
session_id[4:] if session_id.startswith("ses-") else session_id
)
bids_filters["session"] = session_id.removeprefix("ses-")

if bids_filters and out_filename == "report.html":
out_filename = build_path(bids_filters, OUTPUT_NAME_PATTERN)
Expand Down

0 comments on commit 92ff3be

Please sign in to comment.