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__/url.cpython-310.pyc
o

��h0�@s6dZddlmZddlZddlmZddlmZmZm	Z	ddl
m
Z
ddlmZed	d
��Z
edd��Zd
efdd�Zd
edefdd�Zd
efdd�Zd
ededededededeededefdd�Zdeded ed!efd"d#�Zed$d$d%d$d%d$dd$d$d&�	d
ededededed!ededeededefd'd(��ZdS))zURL.�)�	lru_cacheN)�Optional)�parse_qs�unquote�urlsplit�)�hostname)�	validatorcC�t�dtj�S)Nz�(^[\u0100-\u017F\u0180-\u024F]|[-!#$%&'*+/=?^_`{}|~0-9a-z]+(\.[-!#$%&'*+/=?^_`{}|~0-9a-z]+)*$|^([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\011.])*$)��re�compile�
IGNORECASE�rr�D/usr/local/CyberPanel/lib/python3.10/site-packages/validators/url.py�_username_regexs�rcCr
)Nz�^[\/a-z0-9\-\.\_\~\!\$\&\'\(\)\*\+\,\;\=\:\@\%\U0001F300-\U0001F5FF\U0001F600-\U0001F64F\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$rrrrr�_path_regexs�r�valuecCs|r|dvSdS)zValidate scheme.>�ftp�git�irc�ssh�ftps�http�rtmp�rtsp�sftp�https�rtmps�telnetFr)rrrr�_validate_scheme*s���
�r �skip_ipv6_addrcCs|p|�d�dkp|�d�S)zConfirm skip IPv6 check.�:��[)�count�
startswith)rr!rrr�_confirm_ipv6_skip;sr'csp|sdS|�d�}dkrt��t|��S|dkrt��|�S|�dd�\}�t��|�o7t�fdd�dD��S)z Validate authentication segment.Tr"rc3s�|]}|�vVqdS)Nr)�.0�
char_to_avoid��passwordrr�	<genexpr>Ks�
�z)_validate_auth_segment.<locals>.<genexpr>)�/�?�#�@)r%r�matchr�rsplit�all)r�colon_count�usernamerr*r�_validate_auth_segment@s�r6�skip_ipv4_addr�
may_have_port�simple_host�consider_tld�private�rfc_1034�rfc_2782c	Cs�|r	|�d�dkrdS|�d�dkr5tt||�sd|vr|n	|�d��ddd�t||�|||||||d�	S|�dd�\}	}
tt|
|�sGd|vrI|
n	|
�d��ddd�t|
|�|||||||d�	oct|	�S)	zValidate netloc.r0rFz]:r$�]�)r!r7r8�maybe_simpler:r;r<r=)r%rr'�lstrip�replacer2r6)rr!r7r8r9r:r;r<r=�
basic_auth�hostrrr�_validate_netlocPsH�������rE�path�query�fragment�strict_querycCs�d}|r|tt��|��M}z|r#t||dd�r#t||dd�r#|dM}Wnty9|r7t||d�r7|dM}Ynw|rH|tt�d|tj��M}|S)z"Validate path query and fragments.T�&)�strict_parsing�	separator�;)rKz[0-9a-z?/:@\-._~%!$&'()*+,;=]*)�boolrr1r�	TypeErrorr�	fullmatchr)rFrGrHrI�optional_segmentsrrr�_validate_optionals�s,�������rRFT)	r!r7r8r9rIr:r;r<r=c	
Csn|rt�d|�r
dSzt|�\}
}}}
}Wn
tyYdSwt|
�o6t|||||||||	�	o6t||
||�S)a�Return whether or not given value is a valid URL.

    This validator was originally inspired from [URL validator of dperini][1].
    The following diagram is from [urlly][2]::


            foo://admin:hunter1@example.com:8042/over/there?name=ferret#nose
            \_/   \___/ \_____/ \_________/ \__/\_________/ \_________/ \__/
             |      |       |       |        |       |          |         |
          scheme username password hostname port    path      query    fragment

    [1]: https://gist.github.com/dperini/729294
    [2]: https://github.com/treeform/urlly

    Examples:
        >>> url('http://duck.com')
        # Output: True
        >>> url('ftp://foobar.dk')
        # Output: True
        >>> url('http://10.0.0.1')
        # Output: True
        >>> url('http://example.com/">user@example.com')
        # Output: ValidationError(func=url, ...)

    Args:
        value:
            URL string to validate.
        skip_ipv6_addr:
            When URL string cannot contain an IPv6 address.
        skip_ipv4_addr:
            When URL string cannot contain an IPv4 address.
        may_have_port:
            URL string may contain port number.
        simple_host:
            URL string maybe only hyphens and alpha-numerals.
        strict_query:
            Fail validation on query string parsing error.
        consider_tld:
            Restrict domain to TLDs allowed by IANA.
        private:
            Embedded IP address is public if `False`, private/local if `True`.
        rfc_1034:
            Allow trailing dot in domain/host name.
            Ref: [RFC 1034](https://www.rfc-editor.org/rfc/rfc1034).
        rfc_2782:
            Domain/Host name is of type service record.
            Ref: [RFC 2782](https://www.rfc-editor.org/rfc/rfc2782).

    Returns:
        (Literal[True]): If `value` is a valid url.
        (ValidationError): If `value` is an invalid url.
    z\sF)r�searchr�
ValueErrorr rErR)rr!r7r8r9rIr:r;r<r=�scheme�netlocrFrGrHrrr�url�s,C����rW)�__doc__�	functoolsrr�typingr�urllib.parserrrr�utilsr	rr�strr rNr'r6rErRrWrrrr�<module>s�

��������	
�0�������	�
���