# ruff: noqa # mypy: ignore-errors """Rendering helpers for the Reference Scenario Suite generator. Holds the shared mutable output buffers (OUT, ROLLUP) and the small markdown helpers so the generator script (`generate.py`) stays under the LOC budget. Not product code; not imported by the app — only by the generator (run via `PYTHONPATH=. python3 reference_scenarios/generate.py`). """ from __future__ import annotations from typing import List, Tuple Row = Tuple[str, str, str] OUT: List[str] = [] ROLLUP: List[str] = [] def w(s: str = "") -> None: OUT.append(s) def coverage_table(rows: List[Row]) -> None: w("**Architecture Coverage**") w("") w("| Layer | Status | Hinweis |") w("|---|---|---|") for layer, status, note in rows: w("| %s | **%s** | %s |" % (layer, status, note)) ROLLUP.append(status) w("") def reg_map_block(rmap) -> None: w("**Expected Regulatory Map**") w("") w("> " + rmap.executive_summary) w("") for v in rmap.applicable_regulations: obs = ", ".join(o.obligation_id for o in v.obligations) or v.obligations_note w("- **%s** (%s) — Pflichten: %s" % (v.regulation_id, v.name, obs)) for u in rmap.uncertain_regulations: w("- _unsicher_ %s — fehlt: %s" % (u.regulation_id, ", ".join(u.missing_facts) or "-")) for ov in rmap.overlaps: w("- Overlap %s: %s" % (ov.overlap_group_id, ", ".join(ov.shared_obligations))) for ev, ids in rmap.shared_evidence.items(): w("- 1 Nachweis `%s` => %d Pflichten" % (ev, len(ids))) w("") def unsupported_block(rmap) -> None: w("**Expected Unsupported Domains**") w("") if not rmap.unsupported_domains: w("- keine — alle getriggerten Domaenen sind im Korpus") for d in rmap.unsupported_domains: w("- `%s` (Trigger: %s) -> %s" % (d.domain, d.trigger, d.note)) w("") def interp_status(verdict_value: str) -> str: return "PARTIAL" if verdict_value in ("uncertain", "unsupported") else "PASS"