Skip to content

Commit 3783ce7

Browse files
STY: Apply ruff/flynt rule FLY002
FLY002 Consider f-string instead of string join
1 parent d6d726e commit 3783ce7

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

niworkflows/interfaces/bids.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -603,9 +603,7 @@ def _run_interface(self, runtime):
603603
if custom_entities:
604604
# Example: f"{key}-{{{key}}}" -> "task-{task}"
605605
custom_pat = '_'.join(f'{key}-{{{key}}}' for key in sorted(custom_entities))
606-
patterns = [
607-
pat.replace('_{suffix', '_'.join(('', custom_pat, '{suffix'))) for pat in patterns
608-
]
606+
patterns = [pat.replace('_{suffix', f'_{custom_pat}_{{suffix') for pat in patterns]
609607

610608
# Build the output path(s)
611609
dest_files = build_path(out_entities, path_patterns=patterns)
@@ -1108,9 +1106,7 @@ def _run_interface(self, runtime):
11081106
if custom_entities:
11091107
# Example: f"{key}-{{{key}}}" -> "task-{task}"
11101108
custom_pat = '_'.join(f'{key}-{{{key}}}' for key in sorted(custom_entities))
1111-
patterns = [
1112-
pat.replace('_{suffix', '_'.join(('', custom_pat, '{suffix'))) for pat in patterns
1113-
]
1109+
patterns = [pat.replace('_{suffix', f'_{custom_pat}_{{suffix') for pat in patterns]
11141110

11151111
# Prepare SimpleInterface outputs object
11161112
self._results['out_file'] = []

niworkflows/utils/spaces.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ def __call__(self, parser, namespace, values, option_string=None):
722722
# relevant discussions:
723723
# https://github.com/nipreps/niworkflows/pull/457#discussion_r375510227
724724
# https://github.com/nipreps/niworkflows/pull/494
725-
val = ':'.join((val, 'res-native'))
725+
val = f'{val}:res-native'
726726
for sp in Reference.from_string(val):
727727
spaces.add(sp)
728728
setattr(namespace, self.dest, spaces)

0 commit comments

Comments
 (0)