Source code for aeat.application.aggregation._source_profile
"""Source-mesh resolver for user-profile backed registry bindings.Owns :attr:`~core.BindingSourceKind.PROFILE` and returns theprofile-sourced values as a :class:`~._source_mesh.CalculationSourceResolution`.Accepts an optional:class:`~domain.calculations.registry.RegistrySnapshot` at construction;when none is supplied the resolver fetches the matching snapshot lazily from theresident registry authority at resolution time."""from__future__importannotationsfromcollections.abcimportIterablefrom...coreimportBindingSourceKindfrom...domain.calculations.registryimportBindingId,RegistrySnapshotfrom._source_meshimport(CalculationSourceContext,CalculationSourceResolution,)
[docs]defresolve(self,context:CalculationSourceContext)->CalculationSourceResolution:"""Resolve all ``source="profile"`` bindings for the given calculation context. Fetches the :class:`RegistrySnapshot` lazily from the resident registry authority when none was supplied at construction, then delegates to ``resolve_profile_sourced_bindings``, which returns the complete :class:`CalculationSourceResolution` (typed binding channels plus a :class:`CalculationSourceProvenance` row per profile-sourced binding). Args: context: A :class:`CalculationSourceContext` carrying the modelo, filing year, period, and bucket identifier needed to select the correct registry snapshot. Returns: A :class:`CalculationSourceResolution` with typed binding maps and a provenance tuple covering every profile-sourced binding. """snapshot=self._registry_snapshotifsnapshotisNone:from...core.resourcesimportresourcessnapshot=resources().modelos.authority.snapshot(context.modelo,filing_year=context.filing_year,period=context.period.registry_token,)from..modeloimportresolve_profile_sourced_bindingsreturnresolve_profile_sourced_bindings(snapshot,bucket_id=context.bucket_id,profile_record=self._profile_record,caller_binding_ids=self._caller_binding_ids,)