cadrumo.domain.calculations.registry.manual_input_selector module

Selector model for the manual_input binding source family.

Split out from domain.calculations.registry.bindings into its own public defining module because domain.calculations.registry. binding_selector_utils needs ManualInputProvider while bindings imports selector_as_dict / selector_against_model FROM binding_selector_utils – a genuine module-level import cycle that was previously worked around with two function-local imports of a private bindings symbol.

MANUAL_INPUT_RECORD_SHAPE_KEYS: frozenset[str]

Canonical record-field shape keys on the manual_input selector.

Single source of truth for both the typed validator in ManualInputProvider and the layout-binding predicate at is_layout_binding_selector().

is_layout_binding_selector(selector)[source]

Return True when selector carries the record-field layout shape.

The predicate intentionally mirrors the record-shape keys declared on ManualInputProvider rather than re-implementing the check via raw key inspection. Validate gate behaviour stays coupled to the typed model: if the manual_input record-shape key set is ever extended or renamed, the layout predicate follows automatically.

Return type:

bool

Parameters:

selector (Mapping[str, object])

class ManualInputProvider(**data)[source]

Bases: BaseModel

Strict validator for the selector mapping of a manual_input binding.

Two shapes are accepted, gated by _validate_manual_input_shape:

  • Casilla shape {casilla_id, data_type, true_value?, false_value?}: The operator types the value directly into a registry casilla; the casilla_id names the canonical casilla.id and data_type declares how the typed enum / boolean maps to the on-wire payload string. Used for boolean casillas like M100/0168 (estimacion-directa modality flag).

  • Record-field shape {record, field, offset, length, data_type}: The operator types a value that lands in a fichero-BOE record field at a specific byte offset / length. Used by M131 and other modelos whose bindings inject operator-typed metadata into fixed-width records.

The two shapes are exclusive at the validator level.

Parameters:

data (Any)

kind: Literal[BindingSourceKind.MANUAL_INPUT]
casilla_id: CasillaId | None
true_value: str | None
false_value: str | None
record: str | None
field: str | None
offset: int | None
length: int | None
decimals: int | None
signed: bool | None
data_type: ManualInputDataType