Skip to content

Commit

Permalink
[MAINT] Change to use str.removesuffix (#1131)
Browse files Browse the repository at this point in the history
  • Loading branch information
AliceJoubert authored Apr 9, 2024
1 parent 645fd8c commit e63d4eb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions clinica/pipelines/t1_linear/anat_linear_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}."
Expand Down

0 comments on commit e63d4eb

Please sign in to comment.