added docs strings
All checks were successful
continuous-integration/drone/tag Build is passing

This commit is contained in:
2026-01-21 01:00:12 +05:30
parent 81e8a8cd49
commit b6e5114532
17 changed files with 563 additions and 25 deletions

View File

@@ -1,23 +1,67 @@
"""
This module defines the Project class, the top-level container for a documented
project. It aggregates multiple Module instances into a single named entity.
"""
from typing import Dict, Iterable
from docforge.model.module import Module
class Project:
"""Represents a documentation project."""
"""
Represents a documentation project, serving as a container for modules.
Attributes:
name: Name of the project.
modules: Dictionary mapping module paths to Module instances.
"""
def __init__(self, name: str) -> None:
"""
Initialize a new Project.
Args:
name: The name of the project.
"""
self.name = name
self.modules: Dict[str, Module] = {}
def add_module(self, module: Module) -> None:
"""
Add a module to the project.
Args:
module: The module to add.
"""
self.modules[module.path] = module
def get_module(self, path: str) -> Module:
"""
Retrieve a module by its dotted path.
Args:
path: The dotted path of the module (e.g., 'pkg.mod').
Returns:
The requested Module.
"""
return self.modules[path]
def get_all_modules(self) -> Iterable[Module]:
"""
Get all modules in the project.
Returns:
An iterable of Module objects.
"""
return self.modules.values()
def get_module_list(self) -> list[str]:
"""
Get the list of all module dotted paths.
Returns:
A list of module paths.
"""
return list(self.modules.keys())