Fix(python-generator): ignore invalid namespaces #61

Merged
jakob.scheid merged 5 commits from fix/ignore-invalid-python-namespaces into main 2026-10-04 17:19:13 +02:00
15 changed files with 32 additions and 6 deletions
Showing only changes of commit 03fa81f0df - Show all commits

No files matched your search

+12 -6
View File
@@ -1114,12 +1114,18 @@ class PythonDocumentationGenerator:
)
for entry in directory.iterdir():
if entry.is_dir() and (
entry.parent / (f'{entry.stem}.py')
).resolve() not in [e.resolve() for e in entry.parent.iterdir()]:
namespace.add(self._namespace(entry))
elif entry.suffix == '.py':
namespace.add(PythonModuleNamespace(entry.stem))
try:
if entry.is_dir() and (
entry.parent / (f'{entry.stem}.py')
).resolve() not in [
e.resolve() for e in entry.parent.iterdir()
]:
namespace.add(self._namespace(entry))
elif entry.suffix == '.py':
namespace.add(PythonModuleNamespace(entry.stem))
except InvalidNamespaceError:
# the name of the directory or module is invalid; ignore.
pass
return namespace
@@ -0,0 +1,9 @@
# Module `pkg.a.b`
## Function `fn`
### Function signature
```python
fn()
```