From e6be8d5c5d8c226c2ff8716df15d257081bfe7d7 Mon Sep 17 00:00:00 2001 From: David Rotermund <54365609+davrot@users.noreply.github.com> Date: Thu, 2 Feb 2023 19:16:26 +0100 Subject: [PATCH] Add files via upload --- network/pybind11_auto_pyi.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 network/pybind11_auto_pyi.py diff --git a/network/pybind11_auto_pyi.py b/network/pybind11_auto_pyi.py new file mode 100644 index 0000000..73c8bd2 --- /dev/null +++ b/network/pybind11_auto_pyi.py @@ -0,0 +1,23 @@ +# %% +# pip install pybind11-stubgen +from pybind11_stubgen import ModuleStubsGenerator # type: ignore +import glob + + +def process(module_name: str) -> None: + module = ModuleStubsGenerator(module_name) + module.parse() + module.write_setup_py = False + + with open(module_name + ".pyi", "w") as fp: + fp.write("#\n# AUTOMATICALLY GENERATED FILE, DO NOT EDIT!\n#\n\n") + fp.write("\n".join(module.to_lines())) + + +Files = glob.glob("*.so") + +for fid in Files: + Idx: int = fid.find(".") + module_name: str = fid[:Idx] + print("Processing: " + module_name) + process(module_name)