Module
docforge.models.module
This module defines the Module class, which represents a Python module or package in the doc-forge documentation models. It acts as a container for top-level documented objects.
Module
Module(path: str, docstring: Optional[str] = None)
Represents a documented Python module or package.
Attributes:
| Name | Type | Description |
|---|---|---|
path |
str
|
Dotted import path of the module. |
docstring |
Optional[str]
|
Module-level docstring content. |
members |
Dict[str, DocObject]
|
Dictionary mapping object names to their DocObject representations. |
Initialize a new Module.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path |
str
|
The dotted path of the module. |
required |
docstring |
Optional[str]
|
The module's docstring, if any. |
None
|
add_object
add_object(obj: DocObject) -> None
Add a documented object to the module.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj |
DocObject
|
The object to add. |
required |
get_all_objects
get_all_objects() -> Iterable[DocObject]
Get all top-level objects in the module.
Returns:
| Type | Description |
|---|---|
Iterable[DocObject]
|
An iterable of DocObject instances. |
get_object
get_object(name: str) -> DocObject
Retrieve a member object by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name |
str
|
The name of the object. |
required |
Returns:
| Type | Description |
|---|---|
DocObject
|
The requested DocObject. |