updated doc strings
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
"""
|
||||
This module defines the Project class, the top-level container for a documented
|
||||
project. It aggregates multiple Module instances into a single named entity.
|
||||
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
|
||||
modules and provides access to them through a unified interface.
|
||||
"""
|
||||
|
||||
from typing import Dict, Iterable
|
||||
@@ -10,29 +13,32 @@ from docforge.models.module import Module
|
||||
|
||||
class Project:
|
||||
"""
|
||||
Represents a documentation project, serving as a container for modules.
|
||||
Representation of a documentation project.
|
||||
|
||||
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: Dictionary mapping module paths to Module instances.
|
||||
modules: Mapping of module paths to ``Module`` instances.
|
||||
"""
|
||||
|
||||
def __init__(self, name: str) -> None:
|
||||
"""
|
||||
Initialize a new Project.
|
||||
Initialize a Project instance.
|
||||
|
||||
Args:
|
||||
name: The name of the project.
|
||||
name: Name used to identify the documentation project.
|
||||
"""
|
||||
self.name = name
|
||||
self.modules: Dict[str, Module] = {}
|
||||
|
||||
def add_module(self, module: Module) -> None:
|
||||
"""
|
||||
Add a module to the project.
|
||||
Register a module in the project.
|
||||
|
||||
Args:
|
||||
module: The module to add.
|
||||
module: Module instance to add to the project.
|
||||
"""
|
||||
self.modules[module.path] = module
|
||||
|
||||
@@ -41,27 +47,30 @@ class Project:
|
||||
Retrieve a module by its dotted path.
|
||||
|
||||
Args:
|
||||
path: The dotted path of the module (e.g., 'pkg.mod').
|
||||
path: Fully qualified dotted module path (for example ``pkg.module``).
|
||||
|
||||
Returns:
|
||||
The requested Module.
|
||||
The corresponding ``Module`` instance.
|
||||
|
||||
Raises:
|
||||
KeyError: If the module does not exist in the project.
|
||||
"""
|
||||
return self.modules[path]
|
||||
|
||||
def get_all_modules(self) -> Iterable[Module]:
|
||||
"""
|
||||
Get all modules in the project.
|
||||
Return all modules contained in the project.
|
||||
|
||||
Returns:
|
||||
An iterable of Module objects.
|
||||
An iterable of ``Module`` instances.
|
||||
"""
|
||||
return self.modules.values()
|
||||
|
||||
def get_module_list(self) -> list[str]:
|
||||
"""
|
||||
Get the list of all module dotted paths.
|
||||
Return the list of module import paths.
|
||||
|
||||
Returns:
|
||||
A list of module paths.
|
||||
A list containing the dotted paths of all modules in the project.
|
||||
"""
|
||||
return list(self.modules.keys())
|
||||
return list(self.modules.keys())
|
||||
Reference in New Issue
Block a user