#191
gdtest_ref_big_class
OK
CONFIG
Reference config with a big class having >5 methods.
Reference config featuring a big class (>5 methods). Config sets members: true explicitly. Big class methods should get their own subsection.
Build Mode
● Has great-docs.yml
This package ships a pre-supplied config.
The great-docs init step is skipped and
great-docs build uses the spec-defined configuration directly.
Tests specific config options and their rendered output.
Dimensions
P7
P7Big class refreference
Source Files
gdtest_ref_big_class/
__init__.py
"""Test package for reference config with a big class.""" from .core import Manager, create_manager __all__ = ["Manager", "create_manager"]
core.py
"""Core Manager class and factory function."""
class Manager:
"""A manager for orchestrating tasks and resources.
Parameters
----------
name : str
The name of the manager instance.
Examples
--------
>>> m = Manager("prod")
>>> m.status()
'idle'
"""
def __init__(self, name: str):
"""Initialize the manager.
Parameters
----------
name : str
The name of the manager.
"""
self.name = name
self._running = False
self._config: dict = {}
def start(self) -> None:
"""Start the manager.
Returns
-------
None
Examples
--------
>>> m = Manager("test")
>>> m.start()
>>> m.status()
'running'
"""
self._running = True
def stop(self) -> None:
"""Stop the manager.
Returns
-------
None
Examples
--------
>>> m = Manager("test")
>>> m.start()
>>> m.stop()
>>> m.status()
'idle'
"""
self._running = False
def restart(self) -> None:
"""Restart the manager by stopping and starting it.
Returns
-------
None
"""
self.stop()
self.start()
def status(self) -> str:
"""Return the current status of the manager.
Returns
-------
str
Either 'running' or 'idle'.
"""
return "running" if self._running else "idle"
def configure(self, options: dict) -> None:
"""Configure the manager with the given options.
Parameters
----------
options : dict
A dictionary of configuration options.
Returns
-------
None
Examples
--------
>>> m = Manager("test")
>>> m.configure({"timeout": 30})
"""
self._config = options
def report(self) -> dict:
"""Generate a status report for the manager.
Returns
-------
dict
A dictionary containing the manager's status report.
Examples
--------
>>> m = Manager("test")
>>> m.report()
{'name': 'test', 'running': False}
"""
return {"name": self.name, "running": self._running}
def create_manager(name: str) -> Manager:
"""Create and return a new Manager instance.
Parameters
----------
name : str
The name for the new manager.
Returns
-------
Manager
A new Manager instance.
Examples
--------
>>> m = create_manager("main")
>>> m.name
'main'
"""
return Manager(name)README.md
# gdtest-ref-big-class Test reference config with a big class.
great-docs.yml
reference:
- title: Core
desc: Core API
contents:
- name: Manager
members: true
- name: create_manager