@@ -67,8 +67,10 @@ def download_tasks_template(output_path: Path):
67
67
@click .option ("--task-template" , type = click .Path (path_type = Path ), default = None )
68
68
@click .option ("--packages-to-import" , type = click .Path (path_type = Path ), default = None )
69
69
def generate_packages (
70
- output_dir : Path , work_dir : ty .Optional [Path ], task_template : ty .Optional [Path ],
71
- packages_to_import : ty .Optional [Path ]
70
+ output_dir : Path ,
71
+ work_dir : ty .Optional [Path ],
72
+ task_template : ty .Optional [Path ],
73
+ packages_to_import : ty .Optional [Path ],
72
74
):
73
75
if work_dir is None :
74
76
work_dir = Path (tempfile .mkdtemp ())
@@ -82,7 +84,9 @@ def generate_packages(
82
84
task_template = extract_dir / next (extract_dir .iterdir ())
83
85
84
86
if packages_to_import is None :
85
- packages_to_import = Path (__file__ ).parent .parent .parent / "nipype-interfaces-to-import.yaml"
87
+ packages_to_import = (
88
+ Path (__file__ ).parent .parent .parent / "nipype-interfaces-to-import.yaml"
89
+ )
86
90
87
91
with open (packages_to_import ) as f :
88
92
to_import = yaml .load (f , Loader = yaml .SafeLoader )
@@ -315,7 +319,7 @@ def combine_types(type_, prev_type):
315
319
}
316
320
317
321
spec_stub = {
318
- "task_name" : to_snake_case ( interface ) ,
322
+ "task_name" : interface ,
319
323
"nipype_name" : interface ,
320
324
"nipype_module" : nipype_module_str ,
321
325
"inputs" : fields_stub (
@@ -368,10 +372,18 @@ def combine_types(type_, prev_type):
368
372
)
369
373
# Add comments to input and output fields, with their type and description
370
374
for inpt , desc in input_helps .items ():
371
- yaml_str = re .sub (f" ({ inpt } ):(.*)" , r" \1:\2\n # ##PLACEHOLDER##" , yaml_str )
375
+ yaml_str = re .sub (
376
+ f" ({ inpt } ):(.*)" ,
377
+ r" \1:\2\n # ##PLACEHOLDER##" ,
378
+ yaml_str ,
379
+ )
372
380
yaml_str = yaml_str .replace ("##PLACEHOLDER##" , desc )
373
381
for outpt , desc in output_helps .items ():
374
- yaml_str = re .sub (f" ({ outpt } ):(.*)" , r" \1:\2\n # ##PLACEHOLDER##" , yaml_str )
382
+ yaml_str = re .sub (
383
+ f" ({ outpt } ):(.*)" ,
384
+ r" \1:\2\n # ##PLACEHOLDER##" ,
385
+ yaml_str ,
386
+ )
375
387
yaml_str = yaml_str .replace ("##PLACEHOLDER##" , desc )
376
388
377
389
with open (spec_dir / (spec_name + ".yaml" ), "w" ) as f :
@@ -546,7 +558,7 @@ def parse_nipype_interface(
546
558
def extract_doctest_inputs (
547
559
doctest : str , interface : str
548
560
) -> ty .Tuple [
549
- ty .Optional [str ], dict [str , ty .Any ], ty .Optional [str ], ty .List [ty .Dict [str , str ]]
561
+ ty .Optional [str ], ty . Dict [str , ty .Any ], ty .Optional [str ], ty .List [ty .Dict [str , str ]]
550
562
]:
551
563
"""Extract the inputs passed to tasks in the doctests of Nipype interfaces
552
564
0 commit comments