From 92ff3be9e906bdda3a8c46bb8ec39de4ef8957ca Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Thu, 31 Oct 2024 21:20:32 +0100 Subject: [PATCH] Apply ruff/refurb rule FURB188 FURB188 Prefer `removeprefix` over conditionally replacing with slice. --- nireports/assembler/report.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/nireports/assembler/report.py b/nireports/assembler/report.py index c06915a6..4bc386e1 100644 --- a/nireports/assembler/report.py +++ b/nireports/assembler/report.py @@ -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)