Source code for aeat.domain.contribuyente._normalise
"""Canonical normalisation for profile-key lookups.A profile key written by the operator (``TAX.ID``, ``tax-id``,`` tax.id ``) and a profile key stored in the registry (``tax.id``)must compare equal. The normalisation strips surrounding whitespace,lowercases, and folds dashes into dots. Underscores are preservedverbatim so registry-canonical keys (``does_intracomunitario``,``iva.roi_enrolled``) survive the round-trip through the user-CLIstore and reach the deadline engine, which looks values up by exactkey.This is the only definition of the profile-key normaliser. Callersimport this function (or ``ProfileKey.normalise``, which forwardshere) and never re-implement the rule.:func:`normalise_key` is the canonical lookup transform used by:class:`ProfileKey` and the profile-key registry before matching operatorinput against registry-owned profile paths."""from__future__importannotations
[docs]defnormalise_key(value:str)->str:"""Return the canonical form of a profile key for registry lookup."""returnvalue.strip().lower().replace("-",".")