Source code for aeat.application.aggregation._source_fincas
"""Source-mesh readiness resolver adapter for the fincas domain.Provisions the fincas calculation-source surface without enrolling it as a livecalculation source. The fincas domain is not yet ready to feed registry bindings(:func:`~domain.fincas.fincas_source_readiness`), so this resolver resolves NObinding value and emits a blocked-readiness:class:`~application.aggregation.CalculationSourceDiagnostic`. It is deliberatelyNOT registered in :func:`~application.aggregation.merge_source_resolutions`: itexists so the surface is provisioned and its unreadiness is visible rather than asilent blank (``no-dormant-source-resolvers``: provision the surface, refusevisibly). When fincas persistence is hardened, the readiness flips and thisadapter is replaced by a real projecting resolver enrolled in the mesh.See Also: :func:`~domain.fincas.fincas_source_readiness` Domain readiness fact that supplies the blocking reason. :class:`~application.aggregation.CalculationSourceResolution` Shared source-mesh envelope returned by this blocked resolver. :mod:`~application.aggregation._source_inventory` Sibling readiness adapter for the inventory calculation-source surface."""from__future__importannotationsfrom...coreimportBindingSourceKindfrom...domain.fincasimportfincas_source_readinessfrom._source_meshimport(CalculationSourceContext,CalculationSourceDiagnostic,CalculationSourceResolution,)
[docs]classFincasSourceReadinessResolver:"""Refuse the fincas calculation source visibly until it is ready. Owns no live binding source (``owned_sources = ()``) because fincas is not enrolled as a calculation source. :meth:`~FincasSourceReadinessResolver.resolve` returns an empty resolution carrying a blocked-readiness diagnostic whenever fincas is not ready. """resolver_id="fincas_readiness"owned_sources:tuple[BindingSourceKind,...]=()
[docs]defresolve(self,context:CalculationSourceContext)->CalculationSourceResolution:"""Return an empty resolution plus a blocked-readiness diagnostic when unready. Args: context: The calculation source context. Unused: fincas readiness is a context-independent fact (unready regardless of modelo or period). Returns: A :class:`~application.aggregation.CalculationSourceResolution` that resolves no binding value and carries one ``source_domain_not_ready`` diagnostic while fincas is not ready. """delcontextreadiness=fincas_source_readiness()diagnostics:tuple[CalculationSourceDiagnostic,...]=()ifnotreadiness.ready:diagnostics=(CalculationSourceDiagnostic(reason="source_domain_not_ready",source_kind=readiness.source_kind,message=readiness.reason,resolver_id=self.resolver_id,),)returnCalculationSourceResolution(resolver_id=self.resolver_id,owned_sources=(),diagnostics=diagnostics,)