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/__pycache__/domain.cpython-311.pyc
�

�;f�	�
�b�dZddlmZddlZddlmZd�Zedddd�d	ed
ededefd
���Z	dS)zDomain.�)�PathN�)�	validatorc#�K�tt��j�d�����5}t|��}|D]}|���V��	ddd��dS#1swxYwYdS)zLoad IANA TLDs as a Generator.z_tld.txtN)r�__file__�parent�joinpath�open�next�strip)�tld_f�_�lines   �D/opt/alt/python311/lib/python3.11/site-packages/validators/domain.py�	_iana_tldrs�����	
�h���	�	'�	'�
�	3�	3�	8�	8�	:�	:��e���K�K���	�	�D��*�*�,�,�����	���������������������s�+A:�:A>�A>F)�consider_tld�rfc_1034�rfc_2782�valuerrrc��|sdS|rQ|�d���dd��d���t��vrdS	|rdnd}|rdnd}t	jd	|��o`t	jd
|�d�d|�d
�zd|�d�zdzd|��z|�d���d��tj	��S#t$r}td|����|�d}~wwxYw)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�errs       r�domainr*sZ��H���u������S�)�)�0�0��a�8�8��<�B�B�D�D�I�K�K�W�W��u�H�!)�1���r��"*�4�w�w����9�Y��.�.�.�

�2�8�,�>�,�,�,�6�^�6�6�6�
7�0��/�/�/�	
0�+�

+�&�|�%�%�
&�
�L�L�� � �'�'��0�0��M�
4
�
4
�
	
���H�H�H��=�e�=�=�>�>�C�G�����H���s�BC�
C>�&C9�9C>)
�__doc__�pathlibrr �utilsrr�str�boolr*��r�<module>r2s���
�
�������	�	�	�	�����������+0�5�[`�=H�=H�=H��=H�$(�=H�<@�=H�TX�=H�=H�=H���=H�=H�=Hr1