generated from jCloud/repository-template
fix(python-generator): ignore invalid namespaces
Python modules or packages are now ignored if their name is not a valid Python namespace name.
This commit is contained in:
15 files changed
+32
-6
No files matched your search
@@ -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
|
||||
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
# Module `pkg.a.b`
|
||||
|
||||
## Function `fn`
|
||||
|
||||
### Function signature
|
||||
|
||||
```python
|
||||
fn()
|
||||
```
|
||||
+1
@@ -0,0 +1 @@
|
||||
def fn(): ...
|
||||
+1
@@ -0,0 +1 @@
|
||||
def fn(): ...
|
||||
+1
@@ -0,0 +1 @@
|
||||
def fn(): ...
|
||||
+1
@@ -0,0 +1 @@
|
||||
def fn(): ...
|
||||
+1
@@ -0,0 +1 @@
|
||||
def fn(): ...
|
||||
+1
@@ -0,0 +1 @@
|
||||
def fn(): ...
|
||||
+1
@@ -0,0 +1 @@
|
||||
def fn(): ...
|
||||
+1
@@ -0,0 +1 @@
|
||||
def fn(): ...
|
||||
+1
@@ -0,0 +1 @@
|
||||
def fn(): ...
|
||||
Whitespace-only changes.
Whitespace-only changes.
+1
@@ -0,0 +1 @@
|
||||
def fn(): ...
|
||||
+1
@@ -0,0 +1 @@
|
||||
def fn(): ...
|
||||
Reference in new issue
Block a user