diff --git a/niworkflows/interfaces/bids.py b/niworkflows/interfaces/bids.py index ec7131dff3a..508574fb3bf 100644 --- a/niworkflows/interfaces/bids.py +++ b/niworkflows/interfaces/bids.py @@ -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) @@ -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'] = [] diff --git a/niworkflows/utils/spaces.py b/niworkflows/utils/spaces.py index eb82851bd7c..ca386bcff64 100644 --- a/niworkflows/utils/spaces.py +++ b/niworkflows/utils/spaces.py @@ -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)