Module
docforge.models.module
Summary
Documentation model representing a Python module or package.
This module defines the Module class used in the doc-forge documentation
model. A Module acts as a container for top-level documented objects
(classes, functions, variables, and other members) discovered during
introspection.
Classes
Module
Representation of a documented Python module or package.
A Module stores metadata about the module itself and maintains a
collection of top-level documentation objects discovered during
introspection.
Attributes:
| Name | Type | Description |
|---|---|---|
path |
str
|
Dotted import path of the module. |
docstring |
Optional[str]
|
Module-level documentation string, if present. |
members |
Dict[str, DocObject]
|
Mapping of object names to their corresponding |
Initialize a Module instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path |
str
|
Dotted import path identifying the module. |
required |
docstring |
Optional[str]
|
Module-level documentation text, if available. |
None
|
Functions
add_object
Add a documented object to the module.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj |
DocObject
|
Documentation object to register as a top-level member of the module. |
required |
get_all_objects
Return all top-level documentation objects in the module.
Returns:
| Type | Description |
|---|---|
Iterable[DocObject]
|
Iterable[DocObject]:
An iterable of |
get_object
Retrieve a documented object by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name |
str
|
Name of the object to retrieve. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
DocObject |
DocObject
|
The corresponding |
Raises:
| Type | Description |
|---|---|
KeyError
|
If no object with the given name exists. |