File manager - Edit - /usr/local/CyberCP/lib/python3.10/site-packages/validators/__pycache__/domain.cpython-310.pyc
Back
o �h� � @ sX d Z ddlmZ ddlZddlmZ dd� Zedddd �d ededed efdd��Z dS )zDomain.� )�PathN� )� validatorc c sX � t t�j�d��� �} t| �}| D ]}|�� V qW d � dS 1 s%w Y dS )zLoad IANA TLDs as a Generator.z_tld.txtN)r �__file__�parent�joinpath�open�next�strip)�tld_f�_�line� r �D/usr/local/CyberCP/lib/python3.10/site-packages/validators/domain.py� _iana_tld s ��"�r F)�consider_tld�rfc_1034�rfc_2782�valuer r r c C s� | sdS |r| � d��dd�d �� t� vrdS z9|rdnd}|r#dnd}t�d | � oPt�d |� d�d|� d � d|� d� d d|� � | �d��d�tj �W S t ye } zt d| � ��|�d}~ww )a& Return whether or not given value is a valid domain. Examples: >>> domain('example.com') # Output: True >>> domain('example.com/') # Output: ValidationError(func=domain, ...) >>> # Supports IDN domains as well:: >>> domain('xn----gtbspbbmkef.xn--p1ai') # Output: True Args: value: Domain string to validate. consider_tld: Restrict domain to TLDs allowed by IANA. rfc_1034: Allows optional trailing dot in the domain name. Ref: [RFC 1034](https://www.rfc-editor.org/rfc/rfc1034). rfc_2782: Domain name is of type service record. Allows optional underscores in the domain name. Ref: [RFC 2782](https://www.rfc-editor.org/rfc/rfc2782). Returns: (Literal[True]): If `value` is a valid domain name. (ValidationError): If `value` is an invalid domain name. Raises: (UnicodeError): If `value` cannot be encoded into `idna` or decoded into `utf-8`. F�.r ���r � z\.?$�$z\s|__+z^(?:[a-z0-9�]z(?:[a-z0-9-z]{0,61}z[a-z0-9z])?\.)z+[a-z0-9][a-z0-9-_]{0,61}z[a-z]�idnazutf-8zUnable to encode/decode N)�rstrip�rsplit�upperr �re�search�match�encode�decode� IGNORECASE�UnicodeError)r r r r �service_record�trailing_dot�errr r r �domain s0 $$ � ��� ���r( ) �__doc__�pathlibr r �utilsr r �str�boolr( r r r r �<module> s �����
| ver. 1.4 |
Github
|
.
| PHP 8.2.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings