Source code for cadrumo.domain.calculations.registry.condition_mode
"""How a registry declaration combines the conditions it carries.One vocabulary, one definition. Deadline windows, modelo schedules, verificationdeclarations and the parity audit surface all ask the same question of a conditionlist -- must every condition hold, or is one enough -- and each previously spelledthe answer out at its own field. A member added to one spelling would have left theothers validating the old set."""from__future__importannotationsfromenumimportStrEnumfromtypingimportAnnotatedfrompydanticimportBeforeValidatorfrom.schema_baseimportcoerce_enum_member
[docs]classConditionMode(StrEnum):"""Whether a declaration's conditions are conjunctive or disjunctive."""ALL="all""""Every declared condition must hold. The default where a field is silent."""ANY="any""""One holding condition is enough, so the list must not be empty."""
ConditionModeField=Annotated[ConditionMode,BeforeValidator(coerce_enum_member(ConditionMode))]"""Registry condition-mode token hydrated into a member.Registry schema models validate strictly, which refuses a bare TOML string for anenum-typed field, so the token is coerced at the boundary."""__all__=["ConditionMode","ConditionModeField"]