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
+27
-1
No files matched your search
@@ -1114,12 +1114,18 @@ class PythonDocumentationGenerator:
|
|||||||
)
|
)
|
||||||
|
|
||||||
for entry in directory.iterdir():
|
for entry in directory.iterdir():
|
||||||
|
try:
|
||||||
if entry.is_dir() and (
|
if entry.is_dir() and (
|
||||||
entry.parent / (f'{entry.stem}.py')
|
entry.parent / (f'{entry.stem}.py')
|
||||||
).resolve() not in [e.resolve() for e in entry.parent.iterdir()]:
|
).resolve() not in [
|
||||||
|
e.resolve() for e in entry.parent.iterdir()
|
||||||
|
]:
|
||||||
namespace.add(self._namespace(entry))
|
namespace.add(self._namespace(entry))
|
||||||
elif entry.suffix == '.py':
|
elif entry.suffix == '.py':
|
||||||
namespace.add(PythonModuleNamespace(entry.stem))
|
namespace.add(PythonModuleNamespace(entry.stem))
|
||||||
|
except InvalidNamespaceError:
|
||||||
|
# the name of the directory or module is invalid; ignore.
|
||||||
|
pass
|
||||||
|
|
||||||
return namespace
|
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