updated docs strings and added README.md

This commit is contained in:
2026-03-08 17:59:55 +05:30
parent e8e16f3996
commit 8253c25928
37 changed files with 1091 additions and 834 deletions

View File

@@ -1,8 +1,10 @@
"""
# 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
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.
"""
@@ -16,15 +18,19 @@ class Module:
"""
Representation of a documented Python module or package.
A ``Module`` stores metadata about the module itself and maintains a
A `Module` stores metadata about the module itself and maintains a
collection of top-level documentation objects discovered during
introspection.
Attributes:
path: Dotted import path of the module.
docstring: Module-level documentation string, if present.
members: Mapping of object names to their corresponding
``DocObject`` representations.
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 `DocObject` representations.
"""
def __init__(
@@ -36,8 +42,11 @@ class Module:
Initialize a Module instance.
Args:
path: Dotted import path identifying the module.
docstring: Module-level documentation text, if available.
path (str):
Dotted import path identifying the module.
docstring (Optional[str]):
Module-level documentation text, if available.
"""
self.path = path
self.docstring = docstring
@@ -48,8 +57,8 @@ class Module:
Add a documented object to the module.
Args:
obj: Documentation object to register as a top-level
member of the module.
obj (DocObject):
Documentation object to register as a top-level member of the module.
"""
self.members[obj.name] = obj
@@ -58,13 +67,16 @@ class Module:
Retrieve a documented object by name.
Args:
name: Name of the object to retrieve.
name (str):
Name of the object to retrieve.
Returns:
The corresponding ``DocObject`` instance.
DocObject:
The corresponding `DocObject` instance.
Raises:
KeyError: If no object with the given name exists.
KeyError:
If no object with the given name exists.
"""
return self.members[name]
@@ -73,7 +85,7 @@ class Module:
Return all top-level documentation objects in the module.
Returns:
An iterable of ``DocObject`` instances representing the
module's public members.
Iterable[DocObject]:
An iterable of `DocObject` instances representing the module's public members.
"""
return self.members.values()