5 Commits
Author SHA1 Message Date
jakob.scheid 8881f2d46a docs(changelog): add namespace error fix entry
Added a changelog entry for the namespace name error of the Python
project documentation generator.
2026-09-28 22:35:31 +02:00
jakob.scheid 6a4b5187e7 fix(python-generator): resolve directory path
The path to the directory is now completely resolved in
PythonDocumentationGenerator._namespace to prevent from empty path names
if the path is '.'. A fallback was also added for the case that the path
is '/'; the fallback value is irrelevant as the root namespace name is
not included in the output and only the root package path can be '/'.
2026-09-28 22:35:26 +02:00
jcloud-bot Bot eabde41cec chore: update API reference 2026-09-27 23:28:05 +00:00
jakob.scheid cd35457301 Merge pull request 'Fix(ci): API reference configuration error' (#51) from fix/api-reference-workflow-config-error into main
Generate API reference / generate (push) Successful in 21s
Reviewed-on: #51
2026-09-28 01:27:50 +02:00
jakob.scheid 6f2c0871c8 fix(ci): fix API reference configuration error
Fixed a spelling error.
2026-09-28 01:25:16 +02:00
17 changed files with 401 additions and 58 deletions

No files matched your search

+1 -1
View File
@@ -16,7 +16,7 @@ name: Generate API reference
on: on:
push: push:
branch: branches:
- main - main
permissions: permissions:
+6
View File
@@ -1,5 +1,11 @@
# Changelog # Changelog
## [Unreleased]
### Fixed
- Internal namespace name error which occured when generating Python documentation with `.` as the project directory
## [0.2.0] - 2026-09-28 ## [0.2.0] - 2026-09-28
### Added ### Added
@@ -0,0 +1 @@
# Module `jcloud_docsgen.__init__`
@@ -0,0 +1 @@
# Module `jcloud_docsgen.__main__`
@@ -0,0 +1 @@
# Module `jcloud_docsgen.cli.__init__`
+107
View File
@@ -0,0 +1,107 @@
# Module `jcloud_docsgen.cli.cli`
The command line interface
## Function `existing_directory`
### Function signature
```python
existing_directory(path: str) -> pathlib.Path
```
### Returns
Return type: `pathlib.Path`
### Parameters
| Parameter | Type | Kind | Default value | Description |
| --- | --- | --- | --- | --- |
| `path` | `str` | normal | -- | -- |
## Function `error`
Shows an error message and returns the exit code.
### Function signature
```python
error(message: str, exit_code: int = 1)
```
### Parameters
| Parameter | Type | Kind | Default value | Description |
| --- | --- | --- | --- | --- |
| `message` | `str` | normal | -- | The error message to show. |
| `exit_code` | `int` | normal | `1` | The exit code. |
### Docstring
Shows an error message and returns the exit code.
:param message: The error message to show.
:type message: str
:param exit_code: The exit code.
:type exit_code: int
## Function `create_argument_parser`
Prepares a parser to parse the command-line arguments using
argparse.
### Function signature
```python
create_argument_parser() -> argparse.ArgumentParser
```
### Returns
The parser.
Return type: `argparse.ArgumentParser`
### Docstring
Prepares a parser to parse the command-line arguments using
argparse.
:return: The parser.
:rtype: argparse.ArgumentParser
## Function `main`
### Function signature
```python
main(argv=None) -> int
```
### Returns
Return type: `int`
### Parameters
| Parameter | Type | Kind | Default value | Description |
| --- | --- | --- | --- | --- |
| `argv` | -- | normal | `None` | -- |
@@ -0,0 +1 @@
# Module `jcloud_docsgen.cli.languages.__init__`
@@ -0,0 +1,156 @@
# Module `jcloud_docsgen.cli.languages.python`
## Function `parse_sections_list`
Returns a Python definition documentation sections list from the
sections list to be included and the sections list to be excluded.
These lists both consist of the sections as strings which contain
the section name.
### Function signature
```python
parse_sections_list(include_sections: list[str] | None = None, exclude_sections: list[str] = []) -> PythonDefinitionDocumentationIncludeSections
```
### Returns
The Python definition documentation sections object.
Return type: `PythonDefinitionDocumentationIncludeSections`
### Parameters
| Parameter | Type | Kind | Default value | Description |
| --- | --- | --- | --- | --- |
| `include_sections` | `list[str] | None` | normal | `None` | The list of sections to be included. |
| `exclude_sections` | `list[str]` | normal | `[]` | The list of sections to be excluded. |
### Docstring
Returns a Python definition documentation sections list from the
sections list to be included and the sections list to be excluded.
These lists both consist of the sections as strings which contain
the section name.
:param include_sections: The list of sections to be included.
:type include_sections: list[str] | None
:param exclude_sections: The list of sections to be excluded.
:type exclude_sections: list[str]
:return: The Python definition documentation sections object.
:rtype: PythonDefinitionDocumentationIncludeSections
## Function `_generate`
Generates the documentation for a Python project.
### Function signature
```python
_generate(project_directory: pathlib.Path, output_directory: pathlib.Path, *, include_sections: PythonDefinitionDocumentationIncludeSections = PythonDefinitionDocumentationIncludeSections(), allow_html: bool = False, allow_tables: bool = False, force: bool = False) -> None
```
### Returns
Return type: `None`
### Parameters
| Parameter | Type | Kind | Default value | Description |
| --- | --- | --- | --- | --- |
| `project_directory` | `pathlib.Path` | normal | -- | The project directory. |
| `output_directory` | `pathlib.Path` | normal | -- | The output directory. |
| `include_sections` | `PythonDefinitionDocumentationIncludeSections` | keyword-only | `PythonDefinitionDocumentationIncludeSections()` | The sections to be included in the documentation. |
| `allow_html` | `bool` | keyword-only | `False` | Indicates whether HTML is allowed to appear in the generated documentation. |
| `allow_tables` | `bool` | keyword-only | `False` | Indicates whether Markdown tables are allowed. Warning: Markdown tables are not CommonMark. |
| `force` | `bool` | keyword-only | `False` | Indicates whether the output directory shall be overwritten if it is not empty. |
### Docstring
Generates the documentation for a Python project.
:param project_directory: The project directory.
:type project_directory: pathlib.Path
:param output_directory: The output directory.
:type output_directory: pathlib.Path
:param include_sections: The sections to be included in the
documentation.
:type include_sections: PythonDefinitionDocumentationIncludeSections
:param allow_html: Indicates whether HTML is allowed to appear in
the generated documentation.
:type allow_html: bool
:param allow_tables: Indicates whether Markdown tables are allowed.
Warning: Markdown tables are not CommonMark.
:param force: Indicates whether the output directory shall be
overwritten if it is not empty.
:type force: bool
## Function `generate`
Generates the documentation for a Python project.
### Function signature
```python
generate(project_directory: pathlib.Path, output_directory: pathlib.Path, *, include_sections: list[str] | None = None, exclude_sections: list[str] = [], allow_html: bool = False, allow_tables: bool = False, force: bool = False) -> None
```
### Returns
Return type: `None`
### Parameters
| Parameter | Type | Kind | Default value | Description |
| --- | --- | --- | --- | --- |
| `project_directory` | `pathlib.Path` | normal | -- | The project directory. |
| `output_directory` | `pathlib.Path` | normal | -- | The output directory. |
| `include_sections` | `list[str] | None` | keyword-only | `None` | The sections to be included in the documentation. |
| `exclude_sections` | `list[str]` | keyword-only | `[]` | The sections to be excluded in the documentation. |
| `allow_html` | `bool` | keyword-only | `False` | Indicates whether HTML is allowed to appear in the generated documentation. |
| `allow_tables` | `bool` | keyword-only | `False` | Indicates whether Markdown tables are allowed. Warning: Markdown tables are not CommonMark. |
| `force` | `bool` | keyword-only | `False` | Indicates whether the output directory shall be overwritten if it is not empty. |
### Docstring
Generates the documentation for a Python project.
:param project_directory: The project directory.
:type project_directory: pathlib.Path
:param output_directory: The output directory.
:type output_directory: pathlib.Path
:param include_sections: The sections to be included in the
documentation.
:type include_sections: list[str] | None
:param exclude_sections: The sections to be excluded in the
documentation.
:type exclude_sections: list[str]
:param allow_html: Indicates whether HTML is allowed to appear in
the generated documentation.
:type allow_html: bool
:param allow_tables: Indicates whether Markdown tables are allowed.
Warning: Markdown tables are not CommonMark.
:param force: Indicates whether the output directory shall be
overwritten if it is not empty.
:type force: bool
@@ -0,0 +1 @@
# Module `jcloud_docsgen.core.__init__`
@@ -0,0 +1 @@
# Module `jcloud_docsgen.core.python.__init__`
@@ -47,12 +47,12 @@ keyword-only arguments and the var-keyword-argument if there is one.
### Function signature ### Function signature
```python ```python
_group_argument_list(argument_list: list[PythonFunctionArgument]) -> tuple[list[PythonFunctionArgument], list[PythonFunctionArgument], Union[PythonFunctionArgument, None], list[PythonFunctionArgument], Union[PythonFunctionArgument, None]] _group_argument_list(argument_list: list[PythonFunctionArgument]) -> _Arguments
``` ```
### Returns ### Returns
Return type: `tuple[list[PythonFunctionArgument], list[PythonFunctionArgument], Union[PythonFunctionArgument, None], list[PythonFunctionArgument], Union[PythonFunctionArgument, None]]` Return type: `_Arguments`
### Parameters ### Parameters
@@ -75,7 +75,7 @@ keyword-only arguments and the var-keyword-argument if there is one.
:param argument_list: The argument list. :param argument_list: The argument list.
:type argument_list: list[PythonFunctionArgument] :type argument_list: list[PythonFunctionArgument]
:rtype: tuple[list[PythonFunctionArgument], list[PythonFunctionArgument], Union[PythonFunctionArgument, None], list[PythonFunctionArgument], Union[PythonFunctionArgument, None]] :rtype: _Arguments
## Function `_signature_argument_list` ## Function `_signature_argument_list`
@@ -224,7 +224,7 @@ Checks whether the docstring is a docstring or an empty docstring.
### Function signature ### Function signature
```python ```python
_is_docstring(docstring: Union[str, PythonDocstring, None]) -> bool _is_docstring(docstring: str | PythonDocstring | None) -> bool
``` ```
### Returns ### Returns
@@ -237,7 +237,7 @@ Return type: `bool`
| Parameter | Type | Kind | Default value | Description | | Parameter | Type | Kind | Default value | Description |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| `docstring` | `Union[str, PythonDocstring, None]` | normal | -- | The docstring. | | `docstring` | `str | PythonDocstring | None` | normal | -- | The docstring. |
@@ -250,7 +250,7 @@ Return type: `bool`
Checks whether the docstring is a docstring or an empty docstring. Checks whether the docstring is a docstring or an empty docstring.
:param docstring: The docstring. :param docstring: The docstring.
:type docstring: Union[str, PythonDocstring, None] :type docstring: str | PythonDocstring | None
:return: Whether there is a docstring. :return: Whether there is a docstring.
:rtype: bool :rtype: bool
@@ -975,7 +975,7 @@ A documentation generator for a Python module.
##### Method signature ##### Method signature
```python ```python
__init__(self, module_path: ExistingFile, src_directory: Union[ExistingDirectory, None] = None, include_sections: PythonDefinitionDocumentationIncludeSections = PythonDefinitionDocumentationIncludeSections(), **kwargs) -> None __init__(self, module_path: pathlib.Path, src_directory: pathlib.Path | None = None, include_sections: PythonDefinitionDocumentationIncludeSections = PythonDefinitionDocumentationIncludeSections(), **kwargs) -> None
``` ```
##### Returns ##### Returns
@@ -987,8 +987,8 @@ Return type: `None`
| Parameter | Type | Kind | Default value | Description | | Parameter | Type | Kind | Default value | Description |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| `self` | -- | normal | -- | -- | | `self` | -- | normal | -- | -- |
| `module_path` | `ExistingFile` | normal | -- | -- | | `module_path` | `pathlib.Path` | normal | -- | -- |
| `src_directory` | `Union[ExistingDirectory, None]` | normal | `None` | -- | | `src_directory` | `pathlib.Path | None` | normal | `None` | -- |
| `include_sections` | `PythonDefinitionDocumentationIncludeSections` | normal | `PythonDefinitionDocumentationIncludeSections()` | -- | | `include_sections` | `PythonDefinitionDocumentationIncludeSections` | normal | `PythonDefinitionDocumentationIncludeSections()` | -- |
| `kwargs` | -- | kwargs | -- | -- | | `kwargs` | -- | kwargs | -- | -- |
@@ -1125,11 +1125,11 @@ Generates the documentation in the markdown format.
A documentation generator for a Python module. A documentation generator for a Python module.
:param module_path: The path of the module file. :param module_path: The path of the module file.
:type module_path: ExistingFile :type module_path: pathlib.Path
:param src_directory: The directory of the source code. It is :param src_directory: The directory of the source code. It is
optional and only used for making the module optional and only used for making the module
identifiers in the documentation relative. identifiers in the documentation relative.
:type src_directory: Union[ExistingDirectory, None] :type src_directory: pathlib.Path | None
:param include_sections: The sections that will be included. :param include_sections: The sections that will be included.
:type include_sections: PythonDefinitionDocumentationIncludeSections :type include_sections: PythonDefinitionDocumentationIncludeSections
:param kwargs: The options for ``PythonDefinitionDocumentationGenerator``. :param kwargs: The options for ``PythonDefinitionDocumentationGenerator``.
@@ -1197,7 +1197,7 @@ The class for the documentation generator.
##### Method signature ##### Method signature
```python ```python
__init__(self, project_directory: ExistingDirectory, docs_directory: ExistingDirectory, include_sections: PythonDefinitionDocumentationIncludeSections = PythonDefinitionDocumentationIncludeSections(), **kwargs) -> None __init__(self, project_directory: pathlib.Path, docs_directory: pathlib.Path, include_sections: PythonDefinitionDocumentationIncludeSections = PythonDefinitionDocumentationIncludeSections(), **kwargs) -> None
``` ```
##### Returns ##### Returns
@@ -1209,8 +1209,8 @@ Return type: `None`
| Parameter | Type | Kind | Default value | Description | | Parameter | Type | Kind | Default value | Description |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| `self` | -- | normal | -- | -- | | `self` | -- | normal | -- | -- |
| `project_directory` | `ExistingDirectory` | normal | -- | -- | | `project_directory` | `pathlib.Path` | normal | -- | -- |
| `docs_directory` | `ExistingDirectory` | normal | -- | -- | | `docs_directory` | `pathlib.Path` | normal | -- | -- |
| `include_sections` | `PythonDefinitionDocumentationIncludeSections` | normal | `PythonDefinitionDocumentationIncludeSections()` | -- | | `include_sections` | `PythonDefinitionDocumentationIncludeSections` | normal | `PythonDefinitionDocumentationIncludeSections()` | -- |
| `kwargs` | -- | kwargs | -- | -- | | `kwargs` | -- | kwargs | -- | -- |
@@ -1241,14 +1241,14 @@ Returns the project as a namespace.
##### Method signature ##### Method signature
```python ```python
namespace(self) -> list[PythonPackageNamespace] namespace(self) -> PythonPackageNamespace
``` ```
##### Returns ##### Returns
The project as a namespace. The project as a namespace.
Return type: `list[PythonPackageNamespace]` Return type: `PythonPackageNamespace`
##### Parameters ##### Parameters
@@ -1267,7 +1267,7 @@ Return type: `list[PythonPackageNamespace]`
Returns the project as a namespace. Returns the project as a namespace.
:return: The project as a namespace. :return: The project as a namespace.
:rtype: list[PythonPackageNamespace] :rtype: PythonPackageNamespace:
#### Method `generate_documentation` #### Method `generate_documentation`
@@ -1277,7 +1277,7 @@ documentation directory.
##### Method signature ##### Method signature
```python ```python
generate_documentation(self) -> None generate_documentation(self, force: bool = False) -> None
``` ```
##### Returns ##### Returns
@@ -1289,8 +1289,13 @@ Return type: `None`
| Parameter | Type | Kind | Default value | Description | | Parameter | Type | Kind | Default value | Description |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| `self` | -- | normal | -- | -- | | `self` | -- | normal | -- | -- |
| `force` | `bool` | normal | `False` | Indicates whether existing contents of the output directory shall be overwritten. If ``True``, all contents of the output directory will be deleted first. |
##### Exceptions
| Exception | Description |
| --- | --- |
| `DirectoryNotEmptyError` | If ``force`` is ``False`` and the output directory is not empty. |
@@ -1301,6 +1306,16 @@ Return type: `None`
Generates the full project documentation and writes it to the Generates the full project documentation and writes it to the
documentation directory. documentation directory.
:param force: Indicates whether existing contents of the output
directory shall be overwritten. If ``True``, all
contents of the output directory will be deleted
first.
:type force: bool
:raises DirectoryNotEmptyError: If ``force`` is ``False`` and
the output directory is not
empty.
@@ -1310,9 +1325,9 @@ documentation directory.
The class for the documentation generator. The class for the documentation generator.
:param project_directory: The directory of the project. :param project_directory: The directory of the project.
:type project_directory: ExistingDirectory :type project_directory: pathlib.Path
:param docs_directory: The directory for the generated documentation. :param docs_directory: The directory for the generated documentation.
:type docs_directory: ExistingDirectory :type docs_directory: pathlib.Path
:param include_sections: The sections to be included in the documentation. :param include_sections: The sections to be included in the documentation.
:type include_sections: PythonDefinitionDocumentationIncludeSections :type include_sections: PythonDefinitionDocumentationIncludeSections
:param kwargs: The options for ``PythonDefinitionDocumentationGenerator``. :param kwargs: The options for ``PythonDefinitionDocumentationGenerator``.
@@ -20,7 +20,7 @@ Represents an argument of a Python function.
##### Method signature ##### Method signature
```python ```python
__init__(self, name: str, kind: PythonArgumentKind, default: Union[str, None], annotation: Union[str, None]) -> None __init__(self, name: str, kind: PythonArgumentKind, default: str | None, annotation: str | None) -> None
``` ```
##### Returns ##### Returns
@@ -34,8 +34,8 @@ Return type: `None`
| `self` | -- | normal | -- | -- | | `self` | -- | normal | -- | -- |
| `name` | `str` | normal | -- | -- | | `name` | `str` | normal | -- | -- |
| `kind` | `PythonArgumentKind` | normal | -- | -- | | `kind` | `PythonArgumentKind` | normal | -- | -- |
| `default` | `Union[str, None]` | normal | -- | -- | | `default` | `str | None` | normal | -- | -- |
| `annotation` | `Union[str, None]` | normal | -- | -- | | `annotation` | `str | None` | normal | -- | -- |
#### Method `__eq__` #### Method `__eq__`
@@ -123,9 +123,9 @@ Represents an argument of a Python function.
:param kind: The kind of the argument. :param kind: The kind of the argument.
:type kind: ArgumentKind :type kind: ArgumentKind
:param default: The default value of the argument. :param default: The default value of the argument.
:type default: Union[str, None] :type default: str | None
:param annotation: The type annotation of the argument. :param annotation: The type annotation of the argument.
:type annotation: Union[str, None] :type annotation: str | None
## Class `PythonASTArgumentsListParser` ## Class `PythonASTArgumentsListParser`
@@ -8,20 +8,20 @@ not ``None``.
### Function signature ### Function signature
```python ```python
_python_docstring(doc: Union[str, None]) -> Union[PythonDocstring, None] _python_docstring(doc: str | None) -> PythonDocstring | None
``` ```
### Returns ### Returns
The PythonDocstring object or ``None``. The PythonDocstring object or ``None``.
Return type: `Union[PythonDocstring, None]` Return type: `PythonDocstring | None`
### Parameters ### Parameters
| Parameter | Type | Kind | Default value | Description | | Parameter | Type | Kind | Default value | Description |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| `doc` | `Union[str, None]` | normal | -- | The docstring. | | `doc` | `str | None` | normal | -- | The docstring. |
@@ -35,10 +35,10 @@ Returns the PythonDocstring object if the docstring is a string and
not ``None``. not ``None``.
:param doc: The docstring. :param doc: The docstring.
:type doc: Union[str, None] :type doc: str | None
:return: The PythonDocstring object or ``None``. :return: The PythonDocstring object or ``None``.
:rtype: Union[PythonDocstring, None] :rtype: PythonDocstring | None
## Class `PythonDefinition` ## Class `PythonDefinition`
@@ -54,7 +54,7 @@ function definition) classes.
##### Method signature ##### Method signature
```python ```python
__init__(self, name: str, doc: Union[PythonDocstring, None], decorators: list[str]) -> None __init__(self, name: str, doc: PythonDocstring | None, decorators: list[str]) -> None
``` ```
##### Returns ##### Returns
@@ -67,7 +67,7 @@ Return type: `None`
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| `self` | -- | normal | -- | -- | | `self` | -- | normal | -- | -- |
| `name` | `str` | normal | -- | -- | | `name` | `str` | normal | -- | -- |
| `doc` | `Union[PythonDocstring, None]` | normal | -- | -- | | `doc` | `PythonDocstring | None` | normal | -- | -- |
| `decorators` | `list[str]` | normal | -- | -- | | `decorators` | `list[str]` | normal | -- | -- |
#### Method `_arg_list` #### Method `_arg_list`
@@ -176,7 +176,7 @@ function definition) classes.
:param name: The name of the definition. :param name: The name of the definition.
:type name: str :type name: str
:param doc: The docstring. :param doc: The docstring.
:type doc: Union[PythonDocstring, None] :type doc: PythonDocstring | None
:param decorators: The definition decorators. :param decorators: The definition decorators.
:type decorators: list[str] :type decorators: list[str]
@@ -199,7 +199,7 @@ definition.
##### Method signature ##### Method signature
```python ```python
__init__(self, name: str, args: list[PythonFunctionArgument], returns: Union[str, None], doc: Union[PythonDocstring, None], decorators: list[str]) -> None __init__(self, name: str, args: list[PythonFunctionArgument], returns: str | None, doc: PythonDocstring | None, decorators: list[str]) -> None
``` ```
##### Returns ##### Returns
@@ -213,8 +213,8 @@ Return type: `None`
| `self` | -- | normal | -- | -- | | `self` | -- | normal | -- | -- |
| `name` | `str` | normal | -- | -- | | `name` | `str` | normal | -- | -- |
| `args` | `list[PythonFunctionArgument]` | normal | -- | -- | | `args` | `list[PythonFunctionArgument]` | normal | -- | -- |
| `returns` | `Union[str, None]` | normal | -- | -- | | `returns` | `str | None` | normal | -- | -- |
| `doc` | `Union[PythonDocstring, None]` | normal | -- | -- | | `doc` | `PythonDocstring | None` | normal | -- | -- |
| `decorators` | `list[str]` | normal | -- | -- | | `decorators` | `list[str]` | normal | -- | -- |
#### Method `_arg_list` #### Method `_arg_list`
@@ -288,9 +288,9 @@ definition.
:param args: The arguments. :param args: The arguments.
:type args: list[PythonFunctionArgument] :type args: list[PythonFunctionArgument]
:param returns: The return type of the function or class. :param returns: The return type of the function or class.
:type returns: Union[str, None] :type returns: str | None
:param doc: The docstring. :param doc: The docstring.
:type doc: Union[PythonDocstring, None] :type doc: PythonDocstring | None
:param decorators: The definition decorators. :param decorators: The definition decorators.
:type decorators: list[str] :type decorators: list[str]
@@ -322,9 +322,9 @@ definition.
:param args: The arguments. :param args: The arguments.
:type args: list[PythonFunctionArgument] :type args: list[PythonFunctionArgument]
:param returns: The return type of the function or class. :param returns: The return type of the function or class.
:type returns: Union[str, None] :type returns: str | None
:param doc: The docstring. :param doc: The docstring.
:type doc: Union[PythonDocstring, None] :type doc: PythonDocstring | None
:param decorators: The definition decorators. :param decorators: The definition decorators.
:type decorators: list[str] :type decorators: list[str]
@@ -347,7 +347,7 @@ A PythonDefinition subclass representing a Python class definition.
##### Method signature ##### Method signature
```python ```python
__init__(self, name: str, bases: list[str], doc: Union[PythonDocstring, None], decorators: list[str], body: list[PythonDefinition]) -> None __init__(self, name: str, bases: list[str], doc: PythonDocstring | None, decorators: list[str], body: list[PythonDefinition]) -> None
``` ```
##### Returns ##### Returns
@@ -361,7 +361,7 @@ Return type: `None`
| `self` | -- | normal | -- | -- | | `self` | -- | normal | -- | -- |
| `name` | `str` | normal | -- | -- | | `name` | `str` | normal | -- | -- |
| `bases` | `list[str]` | normal | -- | -- | | `bases` | `list[str]` | normal | -- | -- |
| `doc` | `Union[PythonDocstring, None]` | normal | -- | -- | | `doc` | `PythonDocstring | None` | normal | -- | -- |
| `decorators` | `list[str]` | normal | -- | -- | | `decorators` | `list[str]` | normal | -- | -- |
| `body` | `list[PythonDefinition]` | normal | -- | -- | | `body` | `list[PythonDefinition]` | normal | -- | -- |
@@ -435,7 +435,7 @@ A PythonDefinition subclass representing a Python class definition.
:param bases: The base classes. :param bases: The base classes.
:type bases: list[str] :type bases: list[str]
:param doc: The docstring. :param doc: The docstring.
:type doc: Union[PythonDocstring, None] :type doc: PythonDocstring | None
:param decorators: The definition decorators. :param decorators: The definition decorators.
:type decorators: list[str] :type decorators: list[str]
:param body: :param body:
@@ -73,7 +73,7 @@ A subclass of ``PythonNamespace`` for Python package namespaces.
##### Method signature ##### Method signature
```python ```python
__init__(self, name: str, sub_namespaces: List[PythonNamespace]) -> None __init__(self, name: str, sub_namespaces: list[PythonNamespace]) -> None
``` ```
##### Returns ##### Returns
@@ -86,7 +86,7 @@ Return type: `None`
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| `self` | -- | normal | -- | -- | | `self` | -- | normal | -- | -- |
| `name` | `str` | normal | -- | -- | | `name` | `str` | normal | -- | -- |
| `sub_namespaces` | `List[PythonNamespace]` | normal | -- | -- | | `sub_namespaces` | `list[PythonNamespace]` | normal | -- | -- |
#### Method `namespace` #### Method `namespace`
@@ -96,7 +96,7 @@ Returns the namespace object with a specific identifier, such as
##### Method signature ##### Method signature
```python ```python
namespace(self, sub_namespaces: List[str]) -> PythonNamespace namespace(self, sub_namespaces: list[str]) -> PythonNamespace
``` ```
##### Returns ##### Returns
@@ -110,7 +110,7 @@ Return type: `PythonNamespace`
| Parameter | Type | Kind | Default value | Description | | Parameter | Type | Kind | Default value | Description |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| `self` | -- | normal | -- | -- | | `self` | -- | normal | -- | -- |
| `sub_namespaces` | `List[str]` | normal | -- | The identifier of the namespace. | | `sub_namespaces` | `list[str]` | normal | -- | The identifier of the namespace. |
##### Exceptions ##### Exceptions
@@ -347,12 +347,12 @@ Adds a namespace.
##### Method signature ##### Method signature
```python ```python
sub_namespaces(self) -> List[PythonNamespace] sub_namespaces(self) -> list[PythonNamespace]
``` ```
##### Returns ##### Returns
Return type: `List[PythonNamespace]` Return type: `list[PythonNamespace]`
##### Parameters ##### Parameters
@@ -251,3 +251,40 @@ Base class for Python definition errors.
### Base classes ### Base classes
- `PythonDefinitionError` - `PythonDefinitionError`
## Class `DirectoryNotEmptyError`
Directory is not empty.
### Base classes
- `OSError`
### Body
#### Constructor (method `__init__`)
##### Method signature
```python
__init__(self, filename: str | None = None) -> None
```
##### Returns
Return type: `None`
##### Parameters
| Parameter | Type | Kind | Default value | Description |
| --- | --- | --- | --- | --- |
| `self` | -- | normal | -- | -- |
| `filename` | `str | None` | normal | `None` | -- |
### Docstring
Directory is not empty.
+15 -7
View File
@@ -37,7 +37,11 @@ Return type: `None`
| `args` | -- | vararg | -- | -- | | `args` | -- | vararg | -- | -- |
| `kwargs` | -- | kwargs | -- | -- | | `kwargs` | -- | kwargs | -- | -- |
### Decorators
```python
deprecated('Use pathlib.Path instead.')
```
@@ -84,7 +88,11 @@ Return type: `None`
| `args` | -- | vararg | -- | -- | | `args` | -- | vararg | -- | -- |
| `kwargs` | -- | kwargs | -- | -- | | `kwargs` | -- | kwargs | -- | -- |
### Decorators
```python
deprecated('Use pathlib.Path instead.')
```
@@ -230,7 +238,7 @@ attribute)
### Function signature ### Function signature
```python ```python
assert_that_is_instance(obj: object, class_or_tuple: Union[type, types.UnionType, tuple[type, ...]]) -> None assert_that_is_instance(obj: object, class_or_tuple: type | types.UnionType | tuple[type, ...]) -> None
``` ```
### Returns ### Returns
@@ -242,7 +250,7 @@ Return type: `None`
| Parameter | Type | Kind | Default value | Description | | Parameter | Type | Kind | Default value | Description |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| `obj` | `object` | normal | -- | -- | | `obj` | `object` | normal | -- | -- |
| `class_or_tuple` | `Union[type, types.UnionType, tuple[type, ...]]` | normal | -- | -- | | `class_or_tuple` | `type | types.UnionType | tuple[type, ...]` | normal | -- | -- |
## Function `non_empty_str` ## Function `non_empty_str`
@@ -256,20 +264,20 @@ Please note: values are stripped, i. e. if the value consists only
### Function signature ### Function signature
```python ```python
non_empty_str(value: Union[str, None]) -> Union[str, None] non_empty_str(value: str | None) -> str | None
``` ```
### Returns ### Returns
The value or ``None``. The value or ``None``.
Return type: `Union[str, None]` Return type: `str | None`
### Parameters ### Parameters
| Parameter | Type | Kind | Default value | Description | | Parameter | Type | Kind | Default value | Description |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| `value` | `Union[str, None]` | normal | -- | The value. | | `value` | `str | None` | normal | -- | The value. |
@@ -287,10 +295,10 @@ Please note: values are stripped, i. e. if the value consists only
of spaces, it is also considered empty. of spaces, it is also considered empty.
:param value: The value. :param value: The value.
:type value: Union[str, None] :type value: str | None
:return: The value or ``None``. :return: The value or ``None``.
:rtype: Union[str, None] :rtype: str | None
## Function `get_relative_path_segments` ## Function `get_relative_path_segments`
+9 -1
View File
@@ -1096,7 +1096,15 @@ class PythonDocumentationGenerator:
self.kwargs = kwargs self.kwargs = kwargs
def _namespace(self, directory: pathlib.Path) -> PythonPackageNamespace: def _namespace(self, directory: pathlib.Path) -> PythonPackageNamespace:
namespace = PythonPackageNamespace(directory.name, []) namespace = PythonPackageNamespace(
# fallback for the case that the path it '/'. In this case, the
# name would be ''. The fallback value is irrelevant; the name is
# only specified because PythonPackageNamespace requires
# specifying it. The name will not be included in the generated
# output.
directory.resolve().name or 'project',
[],
)
for entry in directory.iterdir(): for entry in directory.iterdir():
if entry.is_dir(): if entry.is_dir():