From e63d4eb227826d226038954db342ab930baf4f68 Mon Sep 17 00:00:00 2001 From: AliceJoubert <158147135+AliceJoubert@users.noreply.github.com> Date: Tue, 9 Apr 2024 13:17:28 +0200 Subject: [PATCH] [MAINT] Change to use str.removesuffix (#1131) --- clinica/pipelines/t1_linear/anat_linear_utils.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/clinica/pipelines/t1_linear/anat_linear_utils.py b/clinica/pipelines/t1_linear/anat_linear_utils.py index 1aafbd605..ca8be7832 100644 --- a/clinica/pipelines/t1_linear/anat_linear_utils.py +++ b/clinica/pipelines/t1_linear/anat_linear_utils.py @@ -32,9 +32,8 @@ def _get_substitutions_datasink(bids_image_id: str, suffix: str) -> list: substitutions : List of tuples of str List of length 3 containing the substitutions to perform. """ - # TODO: Use str.removesuffix once Python 3.8 compatibility is dropped. if bids_image_id.endswith(f"_{suffix}"): - bids_image_id_without_suffix = bids_image_id[: -(len(suffix) + 1)] + bids_image_id_without_suffix = bids_image_id.removesuffix(f"_{suffix}") else: raise ValueError( f"bids image ID {bids_image_id} should end with provided {suffix}."