updated docs strings and added README.md
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
"""
|
||||
# Summary
|
||||
|
||||
Documentation model representing a project.
|
||||
|
||||
This module defines the ``Project`` class, the top-level container used by
|
||||
doc-forge to represent a documented codebase. A ``Project`` aggregates multiple
|
||||
This module defines the `Project` class, the top-level container used by
|
||||
doc-forge to represent a documented codebase. A `Project` aggregates multiple
|
||||
modules and provides access to them through a unified interface.
|
||||
"""
|
||||
|
||||
@@ -15,12 +17,15 @@ class Project:
|
||||
"""
|
||||
Representation of a documentation project.
|
||||
|
||||
A ``Project`` serves as the root container for all modules discovered during
|
||||
A `Project` serves as the root container for all modules discovered during
|
||||
introspection. Each module is stored by its dotted import path.
|
||||
|
||||
Attributes:
|
||||
name: Name of the project.
|
||||
modules: Mapping of module paths to ``Module`` instances.
|
||||
name (str):
|
||||
Name of the project.
|
||||
|
||||
modules (Dict[str, Module]):
|
||||
Mapping of module paths to `Module` instances.
|
||||
"""
|
||||
|
||||
def __init__(self, name: str) -> None:
|
||||
@@ -28,7 +33,8 @@ class Project:
|
||||
Initialize a Project instance.
|
||||
|
||||
Args:
|
||||
name: Name used to identify the documentation project.
|
||||
name (str):
|
||||
Name used to identify the documentation project.
|
||||
"""
|
||||
self.name = name
|
||||
self.modules: Dict[str, Module] = {}
|
||||
@@ -38,7 +44,8 @@ class Project:
|
||||
Register a module in the project.
|
||||
|
||||
Args:
|
||||
module: Module instance to add to the project.
|
||||
module (Module):
|
||||
Module instance to add to the project.
|
||||
"""
|
||||
self.modules[module.path] = module
|
||||
|
||||
@@ -47,13 +54,16 @@ class Project:
|
||||
Retrieve a module by its dotted path.
|
||||
|
||||
Args:
|
||||
path: Fully qualified dotted module path (for example ``pkg.module``).
|
||||
path (str):
|
||||
Fully qualified dotted module path (for example `pkg.module`).
|
||||
|
||||
Returns:
|
||||
The corresponding ``Module`` instance.
|
||||
Module:
|
||||
The corresponding `Module` instance.
|
||||
|
||||
Raises:
|
||||
KeyError: If the module does not exist in the project.
|
||||
KeyError:
|
||||
If the module does not exist in the project.
|
||||
"""
|
||||
return self.modules[path]
|
||||
|
||||
@@ -62,7 +72,8 @@ class Project:
|
||||
Return all modules contained in the project.
|
||||
|
||||
Returns:
|
||||
An iterable of ``Module`` instances.
|
||||
Iterable[Module]:
|
||||
An iterable of `Module` instances.
|
||||
"""
|
||||
return self.modules.values()
|
||||
|
||||
@@ -71,6 +82,7 @@ class Project:
|
||||
Return the list of module import paths.
|
||||
|
||||
Returns:
|
||||
A list containing the dotted paths of all modules in the project.
|
||||
list[str]:
|
||||
A list containing the dotted paths of all modules in the project.
|
||||
"""
|
||||
return list(self.modules.keys())
|
||||
Reference in New Issue
Block a user