style(s51): ruff format hitl module + tests

Gate: ruff format --check . clean.
This commit is contained in:
Kjell Tore Guttormsen 2026-07-15 19:43:41 +02:00
commit 5807ac428c
3 changed files with 48 additions and 11 deletions

View file

@ -34,7 +34,9 @@ _PROVENANCE = ProvenanceStamp(
)
def _write_proposal(outbox: Path, run_id: str, *, verdict_id: str, codes: list[str] | None = None) -> None:
def _write_proposal(
outbox: Path, run_id: str, *, verdict_id: str, codes: list[str] | None = None
) -> None:
items = [AffectedItem(code=c, quantity=1000.0, unit_cost=1.0) for c in (codes or ["05.2"])]
proposal = SavingsProposal(
project_id="P1", measure="LED-retrofit", affected_items=items, claimed_saving_nok=200.0
@ -155,7 +157,9 @@ def test_route_classification_is_load_bearing(tmp_path: Path) -> None:
config = hitl.RoutingConfig(
entries=[
hitl.RoutingEntry(id="z-vei", allowed_code_prefixes=frozenset({"07"}), expert="Zeta"),
hitl.RoutingEntry(id="a-energi", allowed_code_prefixes=frozenset({"05"}), expert="Alpha"),
hitl.RoutingEntry(
id="a-energi", allowed_code_prefixes=frozenset({"05"}), expert="Alpha"
),
]
)
_write_proposal(outbox, "run-A", verdict_id="vA", codes=["99.9"]) # matches nothing
@ -270,4 +274,6 @@ def test_hitl_source_has_no_network_import() -> None:
imported |= {a.name.split(".")[0] for a in node.names}
elif isinstance(node, ast.ImportFrom):
imported.add((node.module or "").split(".")[0])
assert imported & forbidden == set(), f"hitl must not import network libs: {imported & forbidden}"
assert imported & forbidden == set(), (
f"hitl must not import network libs: {imported & forbidden}"
)