API Reference: Do not document private modules (#9042)

This PR prevents documentation of private modules in the API reference
pull/9020/head^2
Eugene Yurtsev 1 year ago committed by GitHub
parent 7edf4ca396
commit aca8cb5fba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -145,8 +145,14 @@ def _load_package_modules(
package_name = package_path.name package_name = package_path.name
for file_path in package_path.rglob("*.py"): for file_path in package_path.rglob("*.py"):
if not file_path.name.startswith("__"): if file_path.name.startswith("_"):
continue
relative_module_name = file_path.relative_to(package_path) relative_module_name = file_path.relative_to(package_path)
if relative_module_name.name.startswith("_"):
continue
# Get the full namespace of the module # Get the full namespace of the module
namespace = str(relative_module_name).replace(".py", "").replace("/", ".") namespace = str(relative_module_name).replace(".py", "").replace("/", ".")
# Keep only the top level namespace # Keep only the top level namespace
@ -222,7 +228,7 @@ Classes
""" """
for class_ in classes: for class_ in classes:
if not class_['is_public']: if not class_["is_public"]:
continue continue
if class_["kind"] == "TypedDict": if class_["kind"] == "TypedDict":

Loading…
Cancel
Save