HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib/python3.10/site-packages/validators/i18n/__pycache__/es.cpython-310.pyc
o

�h��@s�dZddlmZmZddlmZdedeeefdeefdd�Zedefd	d
��Zedefdd��Z	edefd
d��Z
edefdd��ZdS)zSpain.�)�Dict�Set)�	validator�value�number_by_letter�
special_casescCsd||vs
t|�dkrdS|��}d}|�|d|d�|dd�}|��o1|d|t|�dkS)z&Validate if the doi is a NIF or a NIE.�	F�TRWAGMYFPDXBNJZSQVHLCKEr���)�len�upper�get�isdigit�int)rrr�table�numbers�r�E/usr/local/CyberCP/lib/python3.10/site-packages/validators/i18n/es.py�_nif_nie_validation
s  rcCs�|rt|�dkr
dS|��}d}|d}|dd�}|d}|��s$dSdtdd	�t|�D��dd}|d
vr?t|�|kS|dvrI|||kS|dvrW|t|�||hvSdS)
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.
    rF�
JABCDEFGHIrr
r�
cssB�|]\}}|ddkrttttt|�d���nt|�VqdS)�rN)�sum�mapr�str)�.0�index�charrrr�	<genexpr>As
�,�
�zes_cif.<locals>.<genexpr>�ABEH�PSQW�	CDFGJNRUV)r
rrr�	enumerater)rr�	first_chr�doi_body�control�resrrr�es_cifs.����
 r)cCs 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)rrrrrr�es_nifPsr2cCs.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�Zrr0Fr1)rrrrr�es_nieosr8cCst|�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.
    )r8r2r))rrrr�es_doi�sr9N)�__doc__�typingrr�validators.utilsrrrr)r2r8r9rrrr�<module>s"
8