aeat.domain.contribuyente._ccaa module

The closed catalogue of ordinary common-regime Spanish autonomous communities.

Lives in its own module so wizard descriptor construction can reference the enum without triggering the rest of aeat.domain.contribuyente’s import-time chain.

Canonical CCAA shape

This module is the single canonical owner of the CCAA type. All other packages must import from here; no parallel CCAA enum may exist elsewhere in the codebase.

Canonical value space

Each member’s value is the lowercase Spanish name token used by the TOML dispatch tables (e.g. andalucia, madrid). The dispatch table keys in registry/aeat/modelos/100/revisions/2025.toml are deliberately written to match these values so no translation is required at the binding-resolution boundary.

Retired ISO-code Mapping

CCAA.from_iso_code() maps the 3-letter codes that were used by the now-deleted RentaCCAA enum (ANDANDALUCIA, etc.) for call sites that still need to translate those retired codes.

class CCAA(*values)[source]

Bases: StrEnum

Ordinary common-regime autonomous communities for residence profile data.

The canonical value for each member is the lowercase Spanish name token (e.g. "andalucia", "madrid"). These tokens match the dispatch table keys in the Renta 100 registry TOML verbatim.

Foral regimes (País Vasco, Navarra) and the autonomous cities (Ceuta, Melilla) are intentionally excluded; those raise domain.contribuyente.ForalRegimeError when a user selects them.

ANDALUCIA
ARAGON
ASTURIAS
BALEARES
CANARIAS
CANTABRIA
CASTILLA_LA_MANCHA
CASTILLA_Y_LEON
CATALUNA
COMUNIDAD_VALENCIANA
EXTREMADURA
GALICIA
LA_RIOJA
MADRID
MURCIA
classmethod from_iso_code(code)[source]

Return the canonical member for a 3-letter ISO-like CCAA code.

The code set corresponds to the values used by the former RentaCCAA enum (AND, ARA, AST, …). Foral-regime codes (NAV, PVA) and autonomous-city codes (CEU, MEL) are not members of this enum; pass-through to the foral-regime error path is the caller’s responsibility.

Parameters:

code (str) – 3-letter ISO-like CCAA code (e.g. "AND", "MAD").

Return type:

CCAA

Returns:

The matching CCAA member.

Raises:

KeyError – when code is not a recognised 3-letter alias.

classmethod from_label(label)[source]

Parse a free-form label into the canonical member.

Accepts both the canonical lowercase token ("andalucia") and the 3-letter ISO-like code ("AND"), case-insensitively. Underscores and hyphens are normalised to underscores before matching.

Parameters:

label (str) – Free-form label to parse into a CCAA member.

Return type:

CCAA

Returns:

The matching CCAA member.

Raises:

ProfileAnswerTypeError – when label cannot be mapped to any member.