aeat.domain.calculations.registry._period_offset_math module

Period-offset arithmetic shared by previous-filing and relation binding helpers.

Supports quarterly (1T..``4T``), pago-fraccionado (1P..``3P``), and zero-padded monthly (01..``12``) period codes. Offsets wrap across calendar-year boundaries and return the derived period plus the relative year delta.

See also

aeat.domain.calculations.registry._bindings_previous_filing

Previous-filing selectors that derive target-relative source period anchors.

aeat.domain.calculations.registry._relations

Relation source requirements that use the same offset arithmetic.

apply_period_offset(offset, *, target_period)[source]

Apply an integer period offset to a target period code.

Returns (year_delta, derived_period) where year_delta is the number of calendar years by which the derived period precedes or follows the target year (negative = prior year, positive = following year). The tuple is consumed by previous-filing and RelationDefinition source_period_offset_from_target resolution.

Raises:
Return type:

tuple[int, str]

Parameters:
  • offset (int)

  • target_period (str)