Source code for cadrumo.application.storage.calc_sheets.casilla_parity
"""The per-casilla parity verdict published across the calculation surfaces.The type lives in its own public module because it is a CONTRACT rather than astep of the comparison: the CLI renders it, the parity harness returns it, andthe export preview reads it, while the comparison algorithm that populates itstays private to this package. Naming the module for the symbol follows:mod:`cadrumo.core.casilla_id`, which publishes :class:`CasillaId` the same way.See Also: :mod:`~application.storage.calc_sheets.parity_harness` The three-way harness that acquires the values and produces these rows."""from__future__importannotationsfromdecimalimportDecimalfrompydanticimportBaseModelfrom....core.casilla_idimportCasillaIdfrom....core.modelsimportSTRICT_FROZEN_CONFIGas_STRICT_FROZEN
[docs]classCasillaParity(BaseModel):"""Per-casilla parity verdict across three calculation surfaces. Each ``*_vs_*`` flag is ``None`` exactly when one of its two sides carried no value, so "not compared" stays distinguishable from "compared and disagreed" — collapsing them to ``False`` would report a missing oracle as a divergence. ``Decimal`` is imported at module scope rather than under ``TYPE_CHECKING`` because pydantic resolves this model's field annotations at RUNTIME, and ``from __future__ import annotations`` has already turned them into strings. A type-checking-only import leaves the class undefined and fails on first instantiation — while the module still imports, still collects, and still satisfies the linter that recommends the narrower form. Only the fields below need this; the type-checking block keeps everything used solely in function signatures. """model_config=_STRICT_FROZENcasilla_id:CasillaIddisplay_number:strlabel:strlocal:Decimal|None=Nonesheets:Decimal|None=Noneaeat:Decimal|None=Nonesheets_vs_local:bool|None=Nonelocal_vs_aeat:bool|None=Nonesheets_vs_aeat:bool|None=None