File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 2
2
from pathlib import Path
3
3
import typing as ty
4
4
from types import ModuleType
5
+ import re
5
6
import inspect
6
7
import black
7
8
import traits
@@ -329,8 +330,17 @@ def types_to_names(spec_fields):
329
330
spec_str += f" output_spec = { self .task_name } _output_spec\n "
330
331
spec_str += f" executable='{ self .nipype_interface ._cmd } '\n "
331
332
332
- for tp_repl in self .TYPE_REPLACE :
333
- spec_str = spec_str .replace (* tp_repl )
333
+ # for tp_repl in self.TYPE_REPLACE:
334
+ # spec_str = spec_str.replace(*tp_repl)
335
+
336
+ # apply each replacement in TYPE_REPLACE
337
+ for old , new in self .TYPE_REPLACE :
338
+ # add a comma and newline to the old string, to match only at the end of lines
339
+ old += ",\n "
340
+ # add a comma and newline to the new string, to replace with
341
+ new += ",\n "
342
+ # use re.sub to replace old with new, in spec_str
343
+ spec_str = re .sub (old , new , spec_str )
334
344
335
345
spec_str_black = black .format_file_contents (
336
346
spec_str , fast = False , mode = black .FileMode ()
You can’t perform that action at this time.
0 commit comments