Skip to content

Commit c5616d1

Browse files
authored
Merge pull request #12 from nipype/develop
Develop
2 parents 1ee722c + c93922f commit c5616d1

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

nipype2pydra/task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ def add_import(stmt):
767767
add_import("from pathlib import Path")
768768
for test in self.tests:
769769
for stmt in test.imports:
770-
if stmt.module.startswith("nipype.testing"):
770+
if "nipype" in stmt.module:
771771
continue
772772
if stmt.name is None:
773773
add_import(f"import {stmt.module}")

scripts/pkg_gen/create_packages.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@ def download_tasks_template(output_path: Path):
6767
@click.option("--task-template", type=click.Path(path_type=Path), default=None)
6868
@click.option("--packages-to-import", type=click.Path(path_type=Path), default=None)
6969
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],
7274
):
7375
if work_dir is None:
7476
work_dir = Path(tempfile.mkdtemp())
@@ -82,7 +84,9 @@ def generate_packages(
8284
task_template = extract_dir / next(extract_dir.iterdir())
8385

8486
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+
)
8690

8791
with open(packages_to_import) as f:
8892
to_import = yaml.load(f, Loader=yaml.SafeLoader)
@@ -315,7 +319,7 @@ def combine_types(type_, prev_type):
315319
}
316320

317321
spec_stub = {
318-
"task_name": to_snake_case(interface),
322+
"task_name": interface,
319323
"nipype_name": interface,
320324
"nipype_module": nipype_module_str,
321325
"inputs": fields_stub(
@@ -368,10 +372,18 @@ def combine_types(type_, prev_type):
368372
)
369373
# Add comments to input and output fields, with their type and description
370374
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+
)
372380
yaml_str = yaml_str.replace("##PLACEHOLDER##", desc)
373381
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+
)
375387
yaml_str = yaml_str.replace("##PLACEHOLDER##", desc)
376388

377389
with open(spec_dir / (spec_name + ".yaml"), "w") as f:
@@ -546,7 +558,7 @@ def parse_nipype_interface(
546558
def extract_doctest_inputs(
547559
doctest: str, interface: str
548560
) -> 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]]
550562
]:
551563
"""Extract the inputs passed to tasks in the doctests of Nipype interfaces
552564

0 commit comments

Comments
 (0)