measures.UnitMeasures(
unit,
pace,
intent_items,
covered_items,
decisions,
consumers,
implementation_lines,
unit_record_lines,
decision_lines,
evaluation_lines,
)
The pace, the coverage and the size of the specification of one unit.
Attributes
| unit |
str |
Dotted module name. |
| pace |
str |
fast, medium or slow as the record declares it (empty if it declares none, the value as written if that is no pace). |
| intent_items |
int |
Number of intent items. |
| covered_items |
int |
Intent items that name at least one evaluation, all of which the unit’s evaluation files define. |
| decisions |
int |
Number of distinct decision records the intent items cite. |
| consumers |
int |
Number of declared consumers. |
| implementation_lines |
int |
Lines of the implementation. |
| unit_record_lines |
int |
Lines of the unit record (regen/units/<unit>.toml). |
| decision_lines |
int |
Lines of the decision records cited by the intent items, each counted once. |
| evaluation_lines |
int |
Lines of the evaluation files. |
Examples
from pathlib import Path
from tempfile import TemporaryDirectory
from babregen import load_spec, make_sample_repo, unit_measures
with TemporaryDirectory() as tmp:
spec = load_spec(make_sample_repo(Path(tmp) / "demo"))
m = unit_measures(spec, "core.calc")
print(m.pace, m.covered_items, m.intent_items, m.specification_lines, m.ratio)