HEX
Server: LiteSpeed
System: Linux us-phx-web1284.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: u300739242 (300739242)
PHP: 8.2.30
Disabled: system, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python311/lib/python3.11/site-packages/validators/i18n/__pycache__/es.cpython-311.pyc
�

�;f�����dZddlmZmZddlmZdedeeefdeefd�Zedefd���Zedefd	���Z	edefd
���Z
edefd���ZdS)
zSpain.�)�Dict�Set)�	validator�value�number_by_letter�
special_casesc�&�||vst|��dkrdS|���}d}|�|d|d��|dd�z}|���o!|d|t	|��dzkS)z&Validate if the doi is a NIF or a NIE.�	F�TRWAGMYFPDXBNJZSQVHLCKEr���)�len�upper�get�isdigit�int)rrr�table�numberss     �E/opt/alt/python311/lib/python3.11/site-packages/validators/i18n/es.py�_nif_nie_validationr
s����
����U���q����u��K�K�M�M�E�%�E��"�"�5��8�U�1�X�6�6��q��s��C�G��?�?���E��q��U�3�w�<�<�"�3D�-E�!E�E�c��|rt|��dkrdS|���}d}|d}|dd�}|d}|���sdSdtd�t	|��D����dzz
dz}|d	vrt|��|kS|d
vr|||kS|dvr|t|��||hvndS)a�Validate a Spanish CIF.

    Each company in Spain prior to 2008 had a distinct CIF and has been
    discontinued. For more information see [wikipedia.org/cif][1].

    The new replacement is to use NIF for absolutely everything. The issue is
    that there are "types" of NIFs now: company, person [citizen or resident]
    all distinguished by the first character of the DOI. For this reason we
    will continue to call CIFs NIFs, that are used for companies.

    This validator is based on [generadordni.es][2].

    [1]: https://es.wikipedia.org/wiki/C%C3%B3digo_de_identificaci%C3%B3n_fiscal
    [2]: https://generadordni.es/

    Examples:
        >>> es_cif('B25162520')
        # Output: True
        >>> es_cif('B25162529')
        # Output: ValidationError(func=es_cif, args=...)

    Args:
        value:
            DOI string which is to be validated.

    Returns:
        (Literal[True]): If `value` is a valid DOI string.
        (ValidationError): If `value` is an invalid DOI string.
    r
F�
JABCDEFGHIrrr
�
c3��K�|]^\}}|dzdkr?ttttt|��dz������nt|��V��_dS)�rN)�sum�mapr�str)�.0�index�chars   r�	<genexpr>zes_cif.<locals>.<genexpr>Asw����
�
���t�27���a���C��C��S��Y�Y��]�+�+�,�,�-�-�-�S��Y�Y�
�
�
�
�
�
r�ABEH�PSQW�	CDFGJNRUV)rrrr�	enumerater )rr�	first_chr�doi_body�control�ress      r�es_cifr-s��>��C��J�J�!�O�O��u��K�K�M�M�E��E��a��I��Q�q�S�z�H��A�h�G��������u�
�

�
�
� )��2�2�	
�
�
�
�
�
�

�	
�	�	�C��F����3�x�x�7�"�"��F����S�z�W�$�$�09�[�0H�0H�7�s�3�x�x��s��,�,�,�e�Src�8�dddd�}hd�}t|||��S)aValidate a Spanish NIF.

    Each entity, be it person or company in Spain has a distinct NIF. Since
    we've designated CIF to be a company NIF, this NIF is only for person.
    For more information see [wikipedia.org/nif][1]. This validator
    is based on [generadordni.es][2].

    [1]: https://es.wikipedia.org/wiki/N%C3%BAmero_de_identificaci%C3%B3n_fiscal
    [2]: https://generadordni.es/

    Examples:
        >>> es_nif('26643189N')
        # Output: True
        >>> es_nif('26643189X')
        # Output: ValidationError(func=es_nif, args=...)

    Args:
        value:
            DOI string which is to be validated.

    Returns:
        (Literal[True]): If `value` is a valid DOI string.
        (ValidationError): If `value` is an invalid DOI string.
    �0)�L�M�K>�	00000000T�	00000001R�	X0000000T�r)rrrs   r�es_nifr7Ps2��4!�s��5�5��;�;�;�M��u�&6�
�F�F�Frc�N�dddd�}|r|d|vrt||dh��SdS)u�Validate a Spanish NIE.

    The NIE is a tax identification number in Spain, known in Spanish
    as the NIE, or more formally the Número de identidad de extranjero.
    For more information see [wikipedia.org/nie][1]. This validator
    is based on [generadordni.es][2].

    [1]: https://es.wikipedia.org/wiki/N%C3%BAmero_de_identidad_de_extranjero
    [2]: https://generadordni.es/

    Examples:
        >>> es_nie('X0095892M')
        # Output: True
        >>> es_nie('X0095892X')
        # Output: ValidationError(func=es_nie, args=...)

    Args:
        value:
            DOI string which is to be validated.

    Returns:
        (Literal[True]): If `value` is a valid DOI string.
        (ValidationError): If `value` is an invalid DOI string.
    r/�1�2)�X�Y�Zrr5Fr6)rrs  r�es_nier>osF��4!�s��5�5���K��q��-�-�-�"�5�*:�[�M�J�J�J��5rc�\�t|��pt|��pt|��S)a�Validate a Spanish DOI.

    A DOI in spain is all NIF / CIF / NIE / DNI -- a digital ID.
    For more information see [wikipedia.org/doi][1]. This validator
    is based on [generadordni.es][2].

    [1]: https://es.wikipedia.org/wiki/Identificador_de_objeto_digital
    [2]: https://generadordni.es/

    Examples:
        >>> es_doi('X0095892M')
        # Output: True
        >>> es_doi('X0095892X')
        # Output: ValidationError(func=es_doi, args=...)

    Args:
        value:
            DOI string which is to be validated.

    Returns:
        (Literal[True]): If `value` is a valid DOI string.
        (ValidationError): If `value` is an invalid DOI string.
    )r>r7r-)rs r�es_doir@�s&��2�%�=�=�:�F�5�M�M�:�V�E�]�]�:rN)�__doc__�typingrr�validators.utilsrr rr-r7r>r@�rr�<module>rEs)������������'�&�&�&�&�&�
F�s�
F�d�3��8�n�
F�UX�Y\�U]�
F�
F�
F�
F��5T�#�5T�5T�5T���5T�p�G�#�G�G�G���G�<��#�������@�;�#�;�;�;���;�;�;r