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/CyberPanel/lib64/python3.10/site-packages/validators/__pycache__/domain.cpython-310.pyc
o

��h�	�
@sXdZddlmZddlZddlmZdd�Zedddd	�d
ededed
efdd��Z	dS)zDomain.�)�PathN�)�	validatorccsX�tt�j�d����}t|�}|D]}|��VqWd�dS1s%wYdS)zLoad IANA TLDs as a Generator.z_tld.txtN)r�__file__�parent�joinpath�open�next�strip)�tld_f�_�line�r�G/usr/local/CyberPanel/lib/python3.10/site-packages/validators/domain.py�	_iana_tlds��"�rF)�consider_tld�rfc_1034�rfc_2782�valuerrrc
Cs�|sdS|r|�d��dd�d��t�vrdSz9|rdnd}|r#dnd}t�d	|�oPt�d
|�d�d|�d
�d|�d�dd|��|�d��d�tj	�WSt
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)rrrr�service_record�trailing_dot�errrrr�domains0$$

�
���	���r()
�__doc__�pathlibrr�utilsrr�str�boolr(rrrr�<module>s 	�����