Build reference for missing __init__.py files (#3227)

This commit is contained in:
Glenn Jocher 2023-06-17 13:31:46 +02:00 committed by GitHub
parent 0dfafaf39b
commit 03bce07848
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 285 additions and 16 deletions

View file

@ -42,6 +42,7 @@ def create_markdown(py_filepath, module_path, classes, functions):
if len(header_parts) >= 3:
header_content = f"{header_parts[0]}---{header_parts[1]}---\n\n"
module_path = module_path.replace('.__init__', '')
md_content = [f"# {class_name}\n---\n:::{module_path}.{class_name}\n<br><br>\n" for class_name in classes]
md_content.extend(f"# {func_name}\n---\n:::{module_path}.{func_name}\n<br><br>\n" for func_name in functions)
md_content = header_content + "\n".join(md_content)
@ -98,7 +99,7 @@ def main():
nav_items = []
for root, _, files in os.walk(CODE_DIR):
for file in files:
if file.endswith(".py") and file != "__init__.py":
if file.endswith(".py"):
py_filepath = Path(root) / file
classes, functions = extract_classes_and_functions(py_filepath)