Skip to content

Commit

Permalink
STY: Apply ruff/flynt rule FLY002
Browse files Browse the repository at this point in the history
FLY002 Consider f-string instead of string join
  • Loading branch information
DimitriPapadopoulos committed Dec 21, 2024
1 parent d6d726e commit 3783ce7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 2 additions & 6 deletions niworkflows/interfaces/bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,9 +603,7 @@ def _run_interface(self, runtime):
if custom_entities:
# Example: f"{key}-{{{key}}}" -> "task-{task}"
custom_pat = '_'.join(f'{key}-{{{key}}}' for key in sorted(custom_entities))
patterns = [
pat.replace('_{suffix', '_'.join(('', custom_pat, '{suffix'))) for pat in patterns
]
patterns = [pat.replace('_{suffix', f'_{custom_pat}_{{suffix') for pat in patterns]

# Build the output path(s)
dest_files = build_path(out_entities, path_patterns=patterns)
Expand Down Expand Up @@ -1108,9 +1106,7 @@ def _run_interface(self, runtime):
if custom_entities:
# Example: f"{key}-{{{key}}}" -> "task-{task}"
custom_pat = '_'.join(f'{key}-{{{key}}}' for key in sorted(custom_entities))
patterns = [
pat.replace('_{suffix', '_'.join(('', custom_pat, '{suffix'))) for pat in patterns
]
patterns = [pat.replace('_{suffix', f'_{custom_pat}_{{suffix') for pat in patterns]

# Prepare SimpleInterface outputs object
self._results['out_file'] = []
Expand Down
2 changes: 1 addition & 1 deletion niworkflows/utils/spaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ def __call__(self, parser, namespace, values, option_string=None):
# relevant discussions:
# https://github.com/nipreps/niworkflows/pull/457#discussion_r375510227
# https://github.com/nipreps/niworkflows/pull/494
val = ':'.join((val, 'res-native'))
val = f'{val}:res-native'
for sp in Reference.from_string(val):
spaces.add(sp)
setattr(namespace, self.dest, spaces)
Expand Down

0 comments on commit 3783ce7

Please sign in to comment.