Source code for aeat.domain.calculations.registry._aeat_hosts
"""AEAT host predicates shared by registry live-surface guards."""from__future__importannotationsfrom....core.configimportSettings_AEAT_LEGACY_HOST_SUFFIX="aeat.es"
[docs]defaeat_host_suffixes()->tuple[str,...]:"""Return host suffixes treated as AEAT-owned infrastructure."""configured=Settings.external_constants().aeat.domains.host_suffixreturn(configured,_AEAT_LEGACY_HOST_SUFFIX)
[docs]defis_aeat_host(host:str)->bool:"""Return whether ``host`` is under an AEAT-owned suffix."""normalized=host.lower()returnany(normalized==suffixornormalized.endswith(f".{suffix}")forsuffixinaeat_host_suffixes())
[docs]deffirst_aeat_host(hosts:tuple[str,...])->str|None:"""Return the first AEAT-owned host in ``hosts`` or ``None``."""returnnext((hostforhostinhostsifis_aeat_host(host)),None)