Object
docforge.models.object
Summary
Documentation model representing individual Python objects.
This module defines the DocObject class, the fundamental recursive unit of
the doc-forge documentation model. Each DocObject represents a Python
entity such as a class, function, method, or attribute, and may contain nested
members that form a hierarchical documentation structure.
Classes
DocObject
Representation of a documented Python object.
A DocObject models a single Python entity discovered during
introspection. Objects may contain nested members, allowing the structure
of modules, classes, and other containers to be represented recursively.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Local name of the object. |
kind |
str
|
Type of object (for example |
path |
str
|
Fully qualified dotted path to the object. |
signature |
Optional[str]
|
Callable signature if the object represents a callable. |
docstring |
Optional[str]
|
Raw docstring text extracted from the source code. |
members |
Dict[str, DocObject]
|
Mapping of member names to child |
Initialize a DocObject instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name |
str
|
Local name of the object. |
required |
kind |
str
|
Object type identifier (for example |
required |
path |
str
|
Fully qualified dotted path of the object. |
required |
signature |
Optional[str]
|
Callable signature if applicable. |
None
|
docstring |
Optional[str]
|
Documentation string associated with the object. |
None
|
Functions
add_member
Add a child documentation object.
This is typically used when attaching methods to classes or nested objects to their parent containers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj |
DocObject
|
Documentation object to add as a member. |
required |
get_all_members
Return all child members of the object.
Returns:
| Type | Description |
|---|---|
Iterable[DocObject]
|
Iterable[DocObject]:
An iterable of |
get_member
Retrieve a member object by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name |
str
|
Name of the member to retrieve. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
DocObject |
DocObject
|
The corresponding |
Raises:
| Type | Description |
|---|---|
KeyError
|
If the member does not exist. |