File manager - Edit - /home/newsbmcs.com/public_html/static/img/logo/i18n.zip
Back
PK \\�Z����M M fr.pynu �[��� """France.""" # standard from functools import lru_cache import re import typing # local from validators.utils import validator @lru_cache def _ssn_pattern(): """SSN Pattern.""" return re.compile( r"^([1,2])" # gender (1=M, 2=F) r"\s(\d{2})" # year of birth r"\s(0[1-9]|1[0-2])" # month of birth r"\s(\d{2,3}|2[A,B])" # department of birth r"\s(\d{2,3})" # town of birth r"\s(\d{3})" # registration number r"(?:\s(\d{2}))?$", # control key (may or may not be provided) re.VERBOSE, ) @validator def fr_department(value: typing.Union[str, int]): """Validate a french department number. Examples: >>> fr_department(20) # can be an integer # Output: True >>> fr_department("20") # Output: True >>> fr_department("971") # Guadeloupe # Output: True >>> fr_department("00") # Output: ValidationError(func=fr_department, args=...) >>> fr_department('2A') # Corsica # Output: True >>> fr_department('2B') # Output: True >>> fr_department('2C') # Output: ValidationError(func=fr_department, args=...) Args: value: French department number to validate. Returns: (Literal[True]): If `value` is a valid french department number. (ValidationError): If `value` is an invalid french department number. """ if not value: return False if isinstance(value, str): if value in ("2A", "2B"): # Corsica return True try: value = int(value) except ValueError: return False return 1 <= value <= 19 or 21 <= value <= 95 or 971 <= value <= 976 # Overseas departments @validator def fr_ssn(value: str): """Validate a french Social Security Number. Each french citizen has a distinct Social Security Number. For more information see [French Social Security Number][1] (sadly unavailable in english). [1]: https://fr.wikipedia.org/wiki/Num%C3%A9ro_de_s%C3%A9curit%C3%A9_sociale_en_France Examples: >>> fr_ssn('1 84 12 76 451 089 46') # Output: True >>> fr_ssn('1 84 12 76 451 089') # control key is optional # Output: True >>> fr_ssn('3 84 12 76 451 089 46') # wrong gender number # Output: ValidationError(func=fr_ssn, args=...) >>> fr_ssn('1 84 12 76 451 089 47') # wrong control key # Output: ValidationError(func=fr_ssn, args=...) Args: value: French Social Security Number string to validate. Returns: (Literal[True]): If `value` is a valid french Social Security Number. (ValidationError): If `value` is an invalid french Social Security Number. """ if not value: return False matched = re.match(_ssn_pattern(), value) if not matched: return False groups = list(matched.groups()) control_key = groups[-1] department = groups[3] if department != "99" and not fr_department(department): # 99 stands for foreign born people return False if control_key is None: # no control key provided, no additional check needed return True if len(department) == len(groups[4]): # if the department number is 3 digits long (overseas departments), # the town number must be 2 digits long # and vice versa return False if department in ("2A", "2B"): # Corsica's department numbers are not in the same range as the others # thus 2A and 2B are replaced by 19 and 18 respectively to compute the control key groups[3] = "19" if department == "2A" else "18" # the control key is valid if it is equal to 97 - (the first 13 digits modulo 97) digits = int("".join(groups[:-1])) return int(control_key) == (97 - (digits % 97)) PK \\�Z"]P� � __pycache__/ind.cpython-310.pycnu �[��� o �hy � @ s@ d Z ddlZddlmZ edefdd��Zedefdd��ZdS ) zIndia.� N)� validator�valuec C � t �d| �S )a� Validate an indian aadhar card number. Examples: >>> ind_aadhar('3675 9834 6015') True >>> ind_aadhar('3675 ABVC 2133') ValidationFailure(func=aadhar, args={'value': '3675 ABVC 2133'}) Args: value: Aadhar card number string to validate. Returns: (Literal[True]): If `value` is a valid aadhar card number. (ValidationError): If `value` is an invalid aadhar card number. z^[2-9]{1}\d{3}\s\d{4}\s\d{4}$��re�match�r � r �F/usr/local/CyberCP/lib/python3.10/site-packages/validators/i18n/ind.py� ind_aadhar � r c C r )a� Validate a pan card number. Examples: >>> ind_pan('ABCDE9999K') True >>> ind_pan('ABC5d7896B') ValidationFailure(func=pan, args={'value': 'ABC5d7896B'}) Args: value: PAN card number string to validate. Returns: (Literal[True]): If `value` is a valid PAN card number. (ValidationError): If `value` is an invalid PAN card number. z[A-Z]{5}\d{4}[A-Z]{1}r r r r r �ind_pan r r )�__doc__r �validators.utilsr �strr r r r r r �<module> s PK \\�Z��� $ __pycache__/__init__.cpython-310.pycnu �[��� o �he � @ sT d Z ddlmZmZmZmZ ddlmZmZ ddl m Z mZ ddlm Z mZ dZdS )zi18n.� )�es_cif�es_doi�es_nie�es_nif)�fi_business_id�fi_ssn)� fr_department�fr_ssn)� ind_aadhar�ind_pan) r r r r r r r r r r N)�__doc__�esr r r r �fir r �frr r �indr r �__all__� r r �K/usr/local/CyberCP/lib/python3.10/site-packages/validators/i18n/__init__.py�<module> s PK \\�Z��.yU U __pycache__/es.cpython-310.pycnu �[��� o �h� � @ s� d Z ddlmZmZ ddlmZ dedeeef dee fdd�Zedefd d ��Zedefdd��Z edefd d��Z edefdd��ZdS )zSpain.� )�Dict�Set)� validator�value�number_by_letter� special_casesc C sd | |v s t | �dkrdS | �� } d}|�| d | d �| dd� }|�� o1| d |t|�d kS )z&Validate if the doi is a NIF or a NIE.� F�TRWAGMYFPDXBNJZSQVHLCKEr � � � )�len�upper�get�isdigit�int)r r r �table�numbers� r �E/usr/local/CyberCP/lib/python3.10/site-packages/validators/i18n/es.py�_nif_nie_validation s r c C s� | rt | �dkr dS | �� } d}| d }| dd� }| d }|�� s$dS dtdd � t|�D ��d d }|d v r?t|�|kS |dv rI|| |kS |dv rW|t|�|| hv S dS ) 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� JABCDEFGHIr r r � c s sB � | ]\}}|d dkrt tttt|�d ���nt|�V qdS )� r N)�sum�mapr �str)�.0�index�charr r r � <genexpr>A s � ,� �zes_cif.<locals>.<genexpr>�ABEH�PSQW� CDFGJNRUV)r r r r � enumerater )r r � first_chr�doi_body�control�resr r r �es_cif s. ���� r) c C s dddd�}h d�}t | ||�S )a Validate 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 )r r r r r r �es_nifP s r2 c C s. dddd�}| r| d |v rt | |dh�S dS )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�Zr r0 Fr1 )r r r r r �es_nieo s r8 c C s 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. )r8 r2 r) )r r r r �es_doi� s r9 N)�__doc__�typingr r �validators.utilsr r r r) r2 r8 r9 r r r r �<module> s " 8 PK \\�Zs�h/� � __pycache__/fr.cpython-310.pycnu �[��� o �hM � @ sj d Z ddlmZ ddlZddlZddlmZ edd� �Zedeje e f fdd ��Zede fd d��ZdS )zFrance.� )� lru_cacheN)� validatorc C s t �dt j�S )zSSN Pattern.zW^([1,2])\s(\d{2})\s(0[1-9]|1[0-2])\s(\d{2,3}|2[A,B])\s(\d{2,3})\s(\d{3})(?:\s(\d{2}))?$)�re�compile�VERBOSE� r r �E/usr/local/CyberCP/lib/python3.10/site-packages/validators/i18n/fr.py�_ssn_pattern s �r �valuec C s� | sdS t | t�r | dv rdS zt| �} W n ty Y dS w d| ko)dkn pCd| ko5dkn pCd| koAd kS S ) a) Validate a french department number. Examples: >>> fr_department(20) # can be an integer # Output: True >>> fr_department("20") # Output: True >>> fr_department("971") # Guadeloupe # Output: True >>> fr_department("00") # Output: ValidationError(func=fr_department, args=...) >>> fr_department('2A') # Corsica # Output: True >>> fr_department('2B') # Output: True >>> fr_department('2C') # Output: ValidationError(func=fr_department, args=...) Args: value: French department number to validate. Returns: (Literal[True]): If `value` is a valid french department number. (ValidationError): If `value` is an invalid french department number. F��2A�2BT� � � �_ i� i� )� isinstance�str�int� ValueError)r r r r � fr_department s �Hr c C s� | sdS t �t� | �}|sdS t|�� �}|d }|d }|dkr't|�s'dS |du r-dS t|�t|d �kr9dS |dv rG|d krCd nd|d<