diff --git a/niworkflows/engine/tests/test_plugin.py b/niworkflows/engine/tests/test_plugin.py index 4ac852aee2c..7f3f5de5f3b 100644 --- a/niworkflows/engine/tests/test_plugin.py +++ b/niworkflows/engine/tests/test_plugin.py @@ -8,7 +8,7 @@ from ..plugin import MultiProcPlugin -def add(x, y): +def add(x, y): # noqa: FURB118 # the Function interface does not support builtin functions return x + y diff --git a/niworkflows/reports/core.py b/niworkflows/reports/core.py index f6f5a6ffd3a..54cfbb6bdd3 100644 --- a/niworkflows/reports/core.py +++ b/niworkflows/reports/core.py @@ -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-') self.out_filename = f'sub-{self.subject_id}.html' # Default template from niworkflows diff --git a/niworkflows/utils/bids.py b/niworkflows/utils/bids.py index 621d642055e..d1cbc997e60 100644 --- a/niworkflows/utils/bids.py +++ b/niworkflows/utils/bids.py @@ -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] # Remove duplicates participant_label = sorted(set(participant_label)) # Remove labels not found diff --git a/niworkflows/utils/tests/test_utils.py b/niworkflows/utils/tests/test_utils.py index 952c55533fa..7890b5acfed 100644 --- a/niworkflows/utils/tests/test_utils.py +++ b/niworkflows/utils/tests/test_utils.py @@ -83,12 +83,13 @@ def test_clean_symlink(tmp_path): def _gen_skeleton(root): - dirs, files = [], [] - files.append(root / 'file1') - files.append(root / '.file2') - dirs.append(root / 'subdir1') - files.append(dirs[0] / 'file3') - files.append(dirs[0] / '.file4') + dirs = [root / 'subdir1'] + files = [ + root / 'file1', + root / '.file2', + dirs[0] / 'file3', + dirs[0] / '.file4', + ] for d in dirs: d.mkdir() for f in files: