Generate an `__init__.py` that exports the specified modules. :param Path init_path: a file path to create the init file in :param list[tuple] modules: a list of modules each represented as tuples of (name, list_of_exported_symbols)
(init_path, domains)
| 937 | |
| 938 | |
| 939 | def generate_init(init_path, domains): |
| 940 | """Generate an `__init__.py` that exports the specified modules. |
| 941 | |
| 942 | :param Path init_path: a file path to create the init file in |
| 943 | :param list[tuple] modules: a list of modules each represented as tuples |
| 944 | of (name, list_of_exported_symbols) |
| 945 | """ |
| 946 | with open(init_path, "w", encoding="utf-8") as init_file: |
| 947 | init_file.write(INIT_HEADER) |
| 948 | for domain in domains: |
| 949 | init_file.write(f"from . import {domain.module}\n") |
| 950 | init_file.write("from . import util\n\n") |
| 951 | |
| 952 | |
| 953 | def generate_docs(docs_path, domains): |