Skip to content

Commit

Permalink
added __all__ attribute to init
Browse files Browse the repository at this point in the history
  • Loading branch information
tclose committed Mar 3, 2024
1 parent 373a4bb commit d350f4d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nipype-auto-conv/generate
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ auto_dir = PKG_ROOT / "pydra" / "tasks" / PKG_NAME / "auto"
if auto_dir.exists():
shutil.rmtree(auto_dir)

all_interfaces = []
for fspath in sorted(SPECS_DIR.glob("**/*.yaml")):
with open(fspath) as f:
spec = yaml.load(f, Loader=yaml.SafeLoader)
Expand All @@ -56,7 +57,7 @@ for fspath in sorted(SPECS_DIR.glob("**/*.yaml")):
)
converter.generate(PKG_ROOT)
auto_init += f"from .{module_name} import {converter.task_name}\n"

all_interfaces.append(converter.task_name)

with open(PKG_ROOT / "pydra" / "tasks" / PKG_NAME / "auto" / "_version.py", "w") as f:
f.write(
Expand All @@ -68,5 +69,7 @@ post_release = (nipype_version + nipype2pydra_version).replace(".", "")
"""
)

auto_init += "\n\n__all__ = [\n" + "\n".join(f" \"{i}\"," for i in all_interfaces) + "\n]\n"

with open(PKG_ROOT / "pydra" / "tasks" / PKG_NAME / "auto" / "__init__.py", "w") as f:
f.write(auto_init)

0 comments on commit d350f4d

Please sign in to comment.