aeat.domain.calculations.registry._export module

Resolved export layouts for registry-backed AEAT record designs.

Resolves export layouts declared on a ModeloRevision and verifies them against a RegistrySnapshot. The resolved layout is a ResolvedExportLayout ready for fixed-width filing assembly.

class ResolvedExportLayout(**data)[source]

Bases: RegistryModel

A selected, validated export layout ready for read-only filing assembly.

Parameters:
layout: ExportLayoutDefinition
ordered_fields: tuple[ExportFieldDefinition, ...]
fields_by_id: Mapping[ExportFieldId, ExportFieldDefinition]
fields_by_casilla: Mapping[CasillaId, tuple[ExportFieldDefinition, ...]]
resolve_export_layout(snapshot, layout_id=None)[source]

Resolve one export layout from a validated registry snapshot.

Parameters:
  • snapshot (RegistrySnapshot) – The RegistrySnapshot to resolve the layout from.

  • layout_id (str | None) – Identifier of the export layout to resolve. May be None when the revision declares exactly one layout; otherwise required to disambiguate.

Return type:

ResolvedExportLayout

Returns:

The ResolvedExportLayout for the selected layout.

derive_export_layouts_from_bindings(revision)[source]

Return revision export layouts with binding-derived fields resolved.

Some official AEAT record designs expose structured filing records that are already represented as registry bindings. In those cases the export layout declares the record-level intent via binding_record and this resolver derives field coordinates from the binding selectors instead of requiring a second coordinate table in TOML.

Parameters:

revision (ModeloRevision) – The ModeloRevision whose export layouts and bindings are used to derive the resolved field coordinates.

Return type:

tuple[ExportLayoutDefinition, ...]

Returns:

Tuple of ExportLayoutDefinition with binding-derived fields populated.

export_fields_for_casilla(resolved, casilla_id)[source]

Return all ExportFieldDefinition entries mapped to casilla_id.

Return type:

tuple[ExportFieldDefinition, ...]

Parameters: