From d350f4ddc958f95bdca84d93765759daa1e9db8b Mon Sep 17 00:00:00 2001 From: Tom Close Date: Mon, 4 Mar 2024 07:36:02 +1100 Subject: [PATCH] added __all__ attribute to init --- nipype-auto-conv/generate | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nipype-auto-conv/generate b/nipype-auto-conv/generate index fac320e..9f4b509 100755 --- a/nipype-auto-conv/generate +++ b/nipype-auto-conv/generate @@ -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) @@ -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( @@ -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)