"""
return name.startswith('_') and not (name.startswith('__') and name.endswith('__'))
-def is_internal_or_imported_module_member(parent, path: str, name: str, object) -> bool:
+def is_internal_or_imported_module_member(state: State, parent, path: str, name: str, object) -> bool:
"""If the module member is internal or imported."""
if name.startswith('_'): return True
# handle modules and packages differently. See also for more info:
# https://stackoverflow.com/a/7948672
else:
+ # pybind11 submodules have __package__ set to None for nested modules,
+ # the top-level __package__ is '' though. Allow these if parent
+ # __package__ is empty (either '' or None).
+ if state.config['PYBIND11_COMPATIBILITY'] and object.__package__ is None and not parent.__package__: return False
+
# The parent is a single-file module (not a package), these don't have
# submodules so this is most definitely an imported module. Source:
# https://docs.python.org/3/reference/import.html#packages
else:
# Get (and render) inner modules
for name, object in inspect.getmembers(module, inspect.ismodule):
- if is_internal_or_imported_module_member(module, path, name, object): continue
+ if is_internal_or_imported_module_member(state, module, path, name, object): continue
subpath = path + [name]
page.modules += [extract_module_doc(subpath, object)]
# Get (and render) inner classes
for name, object in inspect.getmembers(module, lambda o: inspect.isclass(o) and not is_enum(state, o)):
- if is_internal_or_imported_module_member(module, path, name, object): continue
+ if is_internal_or_imported_module_member(state, module, path, name, object): continue
subpath = path + [name]
if not object.__doc__: logging.warning("%s is undocumented", '.'.join(subpath))
# Get enums
for name, object in inspect.getmembers(module, lambda o: is_enum(state, o)):
- if is_internal_or_imported_module_member(module, path, name, object): continue
+ if is_internal_or_imported_module_member(state, module, path, name, object): continue
subpath = path + [name]
if not object.__doc__: logging.warning("%s is undocumented", '.'.join(subpath))
# Get inner functions
for name, object in inspect.getmembers(module, lambda o: inspect.isfunction(o) or inspect.isbuiltin(o)):
- if is_internal_or_imported_module_member(module, path, name, object): continue
+ if is_internal_or_imported_module_member(state, module, path, name, object): continue
subpath = path + [name]
if not object.__doc__: logging.warning("%s() is undocumented", '.'.join(subpath))
# Get data
# TODO: unify this query
for name, object in inspect.getmembers(module, lambda o: not inspect.ismodule(o) and not inspect.isclass(o) and not inspect.isroutine(o) and not inspect.isframe(o) and not inspect.istraceback(o) and not inspect.iscode(o)):
- if is_internal_or_imported_module_member(module, path, name, object): continue
+ if is_internal_or_imported_module_member(state, module, path, name, object): continue
page.data += [extract_data_doc(module, path + [name], object)]
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>pybind_submodules | My Python Project</title>
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
+ <link rel="stylesheet" href="m-dark+documentation.compiled.css" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+ <div class="m-container">
+ <div class="m-row">
+ <a href="index.html" id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">My Python Project</a>
+ </div>
+ </div>
+</nav></header>
+<main><article>
+ <div class="m-container m-container-inflatable">
+ <div class="m-row">
+ <div class="m-col-l-10 m-push-l-1">
+ <h1>
+ pybind_submodules <span class="m-thin">module</span>
+ </h1>
+ <p>pybind11 submodules</p>
+ <div class="m-block m-default">
+ <h3>Contents</h3>
+ <ul>
+ <li>
+ Reference
+ <ul>
+ <li><a href="#packages">Modules</a></li>
+ </ul>
+ </li>
+ </ul>
+ </div>
+ <section id="namespaces">
+ <h2><a href="#namespaces">Modules</a></h2>
+ <dl class="m-doc">
+ <dt>module <a href="pybind_submodules.another.html" class="m-doc">another</a></dt>
+ <dd>Yay another</dd>
+ <dt>module <a href="pybind_submodules.sub.html" class="m-doc">sub</a></dt>
+ <dd>Yay a submodule</dd>
+ </dl>
+ </section>
+ </div>
+ </div>
+ </div>
+</article></main>
+</body>
+</html>