updated docs strings and added README.md
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
"""
|
||||
# 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
|
||||
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.
|
||||
"""
|
||||
@@ -14,18 +16,28 @@ class DocObject:
|
||||
"""
|
||||
Representation of a documented Python object.
|
||||
|
||||
A ``DocObject`` models a single Python entity discovered during
|
||||
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: Local name of the object.
|
||||
kind: Type of object (for example ``class``, ``function``,
|
||||
``method``, or ``attribute``).
|
||||
path: Fully qualified dotted path to the object.
|
||||
signature: Callable signature if the object represents a callable.
|
||||
docstring: Raw docstring text extracted from the source code.
|
||||
members: Mapping of member names to child ``DocObject`` instances.
|
||||
name (str):
|
||||
Local name of the object.
|
||||
|
||||
kind (str):
|
||||
Type of object (for example `class`, `function`, `method`, or `attribute`).
|
||||
|
||||
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 `DocObject` instances.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
@@ -40,11 +52,20 @@ class DocObject:
|
||||
Initialize a DocObject instance.
|
||||
|
||||
Args:
|
||||
name: Local name of the object.
|
||||
kind: Object type identifier (for example ``class`` or ``function``).
|
||||
path: Fully qualified dotted path of the object.
|
||||
signature: Callable signature if applicable.
|
||||
docstring: Documentation string associated with the object.
|
||||
name (str):
|
||||
Local name of the object.
|
||||
|
||||
kind (str):
|
||||
Object type identifier (for example `class` or `function`).
|
||||
|
||||
path (str):
|
||||
Fully qualified dotted path of the object.
|
||||
|
||||
signature (Optional[str]):
|
||||
Callable signature if applicable.
|
||||
|
||||
docstring (Optional[str]):
|
||||
Documentation string associated with the object.
|
||||
"""
|
||||
self.name = name
|
||||
self.kind = kind
|
||||
@@ -70,13 +91,16 @@ class DocObject:
|
||||
Retrieve a member object by name.
|
||||
|
||||
Args:
|
||||
name: Name of the member to retrieve.
|
||||
name (str):
|
||||
Name of the member to retrieve.
|
||||
|
||||
Returns:
|
||||
The corresponding ``DocObject`` instance.
|
||||
DocObject:
|
||||
The corresponding `DocObject` instance.
|
||||
|
||||
Raises:
|
||||
KeyError: If the member does not exist.
|
||||
KeyError:
|
||||
If the member does not exist.
|
||||
"""
|
||||
return self.members[name]
|
||||
|
||||
@@ -85,6 +109,7 @@ class DocObject:
|
||||
Return all child members of the object.
|
||||
|
||||
Returns:
|
||||
An iterable of ``DocObject`` instances representing nested members.
|
||||
Iterable[DocObject]:
|
||||
An iterable of `DocObject` instances representing nested members.
|
||||
"""
|
||||
return self.members.values()
|
||||
|
||||
Reference in New Issue
Block a user