HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/urllib3/util/__pycache__/url.cpython-310.pyc
o

wem;�@s~ddlmZddlZddlZddlmZddlmZdZe�	d�Z
e�	d	�Ze�	d
ejej
B�ZdZdZd
jeed�Zeed�Zgd�ZdZdd�dd�eD��dZdedZdededZdZe�	d�Ze�	ded�Ze�	ded�Ze�	ded�Ze�	dedd�d�Ze�	d ed!�Z d"eeefZ!e�	e!ejej
B�Z"e#d#�Z$e#d$�Z%e$e%Bd%hBZ&e&d&d'hBZ'e'd(hBZ(Z)Gd)d*�d*e�*d*d+ej+e,fd,ej+e,fd-ej+e,fd.ej+e-fd/ej+e,fd0ej+e,fd1ej+e,fg��Z.ej/dMd7d8��Z0ej/dNd:d8��Z0dOd<d8�Z0dPd=d>�Z1ej/dQd?d@��Z2ej/dRdAd@��Z2dSdBd@�Z2dTdEdF�Z3dUdHdI�Z4dVdKdL�Z5dS)W�)�annotationsN�)�LocationParseError�)�to_str)�http�httpsNz%[a-fA-F0-9]{2}z^(?:[a-zA-Z][a-zA-Z0-9+-]*:|/)zS^(?:([a-zA-Z][a-zA-Z0-9+.-]*):)?(?://([^\\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$z(?:[0-9]{1,3}\.){3}[0-9]{1,3}z[0-9A-Fa-f]{1,4}z(?:{hex}:{hex}|{ipv4}))�hex�ipv4)r	�ls32)	z(?:%(hex)s:){6}%(ls32)sz::(?:%(hex)s:){5}%(ls32)sz%(?:%(hex)s)?::(?:%(hex)s:){4}%(ls32)sz2(?:(?:%(hex)s:)?%(hex)s)?::(?:%(hex)s:){3}%(ls32)sz6(?:(?:%(hex)s:){0,2}%(hex)s)?::(?:%(hex)s:){2}%(ls32)sz/(?:(?:%(hex)s:){0,3}%(hex)s)?::%(hex)s:%(ls32)sz'(?:(?:%(hex)s:){0,4}%(hex)s)?::%(ls32)sz&(?:(?:%(hex)s:){0,5}%(hex)s)?::%(hex)sz(?:(?:%(hex)s:){0,6}%(hex)s)?::zCABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._\-~z(?:�|cCsg|]}|t�qS�)�_subs)�.0�xr
r
�I/home/arjun/projects/env/lib/python3.10/site-packages/urllib3/util/url.py�
<listcomp>4�r�)z
(?:%25|%)(?:[z]|%[a-fA-F0-9]{2})+z\[z)?\]z!(?:[^\[\]%:/?#]|%[a-fA-F0-9]{2})*z!^(/[^?#]*)(?:\?([^#]*))?(?:#.*)?$�^�$����(z)\]$z)^(%s|%s|%s)(?::0*?(|0|[1-9][0-9]{0,4}))?$zBABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-~z!$&'()*+,;=�:�@�/�?cs�eZdZdZ							dd�fdd
�
Zeddd��Zeddd��Zeddd��Zeddd��Z	eddd��Z
ddd�Z�ZS) �Urlz�
    Data structure for representing an HTTP URL. Used as a return value for
    :func:`parse_url`. Both the scheme and host are normalized as they are
    both case-insensitive according to RFC 3986.
    N�scheme�
str | None�auth�host�port�
int | None�path�query�fragmentc
s@|r|�d�sd|}|dur|��}t��||||||||�S)Nr)�
startswith�lower�super�__new__)�clsrr r!r"r$r%r&��	__class__r
rr*ds

zUrl.__new__�returncC�|jS)z@For backwards-compatibility with urlparse. We're nice like that.)r!��selfr
r
r�hostnametszUrl.hostname�strcCs&|jpd}|jdur|d|j7}|S)z)Absolute path including the query string.rNr)r$r%)r1�urir
r
r�request_uriys

zUrl.request_uricCs.|j}|j}|dus|dur|S|�d|��S)z�
        Authority component as defined in RFC 3986 3.2.
        This includes userinfo (auth), host and port.

        i.e.
            userinfo@host:port
        Nr)r �netloc)r1�userinfor6r
r
r�	authority�s
	z
Url.authoritycCs,|jdurdS|jr|j�d|j��S|jS)z�
        Network location including host and port.

        If you need the equivalent of urllib.parse's ``netloc``,
        use the ``authority`` property instead.
        Nr)r!r"r0r
r
rr6�s

z
Url.netlocc	Cs�|\}}}}}}}d}|dur||d7}|dur||d7}|dur'||7}|dur3|dt|�7}|dur;||7}|durE|d|7}|durO|d|7}|S)a2
        Convert self into a url

        This function should more or less round-trip with :func:`.parse_url`. The
        returned url may not be exactly the same as the url inputted to
        :func:`.parse_url`, but it should be equivalent by the RFC (e.g., urls
        with a blank port will have : removed).

        Example:

        .. code-block:: python

            import urllib3

            U = urllib3.util.parse_url("https://google.com/mail/")

            print(U.url)
            # "https://google.com/mail/"

            print( urllib3.util.Url("https", "username:password",
                                    "host.com", 80, "/path", "query", "fragment"
                                    ).url
                )
            # "https://username:password@host.com:80/path?query#fragment"
        �Nz://rrr�#)r3)	r1rr r!r"r$r%r&�urlr
r
rr;�s"zUrl.urlcCr/�N)r;r0r
r
r�__str__�szUrl.__str__)NNNNNNN)rrr rr!rr"r#r$rr%rr&r)r.r)r.r3)
�__name__�
__module__�__qualname__�__doc__r*�propertyr2r5r8r6r;r=�
__classcell__r
r
r,rrPs*�	
/rrr r!r"r$r%r&�	componentr3�
allowed_chars�typing.Container[str]r.cC�dSr<r
�rDrEr
r
r�_encode_invalid_chars��rI�NonecCrGr<r
rHr
r
rrI�rJrc	Cs�|dur|St|�}t�dd�|�\}}|�dd�}||�d�k}t�}tdt|��D]7}|||d�}t|�}|r?|dksI|d	krN|�	�|vrN||7}q+|�
dt|�d
d����d
��
��q+|�	�S)zfPercent-encodes a URI component without reapplying
    onto an already percent-encoded component.
    NcSs|�d���S)Nr)�group�upper)�matchr
r
r�<lambda>�sz'_encode_invalid_chars.<locals>.<lambda>zutf-8�
surrogatepass�%rr�r)r�_PERCENT_RE�subn�encode�count�	bytearray�range�len�ord�decode�extendr	�zfillrM)	rDrE�percent_encodings�	uri_bytes�is_percent_encoded�encoded_component�i�byte�byte_ordr
r
rrI�s$�*cCs�|�d�}g}|D]}|dkrq	|dkr|�|�q	|r |��q	|�d�r2|r,|dr2|�dd�|�d�r<|�d�d�|�S)Nr�.z..rr9)z/.z/..)�split�append�popr'�insert�endswith�join)r$�segments�output�segmentr
r
r�_remove_path_dot_segmentss
�


rocCrGr<r
�r!rr
r
r�_normalize_host%�rqcCrGr<r
rpr
r
rrq*rrcCs�|rh|tvrht�|�}|rSt�|�}|rO|�d�\}}|||�}|�d�r1|dkr1|dd�}n|dd�}t|t�}|d|��	��d|�||d���S|�	�St
�|�shtd�dd�|�
d�D��d	�S|S)
Nrz%25��%�.cSsg|]}t|��qSr
)�_idna_encode)r�labelr
r
rrFrz#_normalize_host.<locals>.<listcomp>re�ascii)�_NORMALIZABLE_SCHEMES�_IPV6_ADDRZ_RErN�_ZONE_ID_RE�search�spanr'rI�_UNRESERVED_CHARSr(�_IPV4_RErrkrf)r!r�is_ipv6rN�start�end�zone_idr
r
rrq/s(


&
��name�bytescCsv|��s4zddl}Wntytd�d�wz|j|��ddd�WS|jy3td|�d��d�w|���d�S)Nrz-Unable to parse URL without the 'idna' moduleT)�strict�
std3_ruleszName 'z' is not a valid IDNA labelrx)�isascii�idna�ImportErrorrrUr(�	IDNAError)r�r�r
r
rrvLs(���
���rv�targetcCsTt�|�}|st|�d���|��\}}t|t�}|dur(t|t�}|d|7}|S)z�Percent-encodes a request target so that there are no invalid characters

    Pre-condition for this function is that 'target' must start with '/'.
    If that is the case then _TARGET_RE will always produce a match.
    z is not a valid request URINr)�
_TARGET_RErNr�groupsrI�_PATH_CHARS�_QUERY_CHARS)r�rNr$r%�encoded_targetr
r
r�_encode_target_s


r�r;c
Cs�|st�S|}t�|�sd|}z�t�|���\}}}}}|dup&|��tv}|r-|��}|rT|�d�\}}	}
|p:d}t	�|
���\}}|rM|rMt
|t�}|dkrSd}nd\}}}|durtt|�}
d|
krndksst
|��t
|��nd}
t||�}|r�|r�t|�}t
|t�}|r�|r�t
|t�}|r�|r�t
|t�}Wnttfy�}zt
|�|�d}~ww|s�|dus�|dur�d}nd}t||||
|||d�S)	a�
    Given a url, return a parsed :class:`.Url` namedtuple. Best-effort is
    performed to parse incomplete urls. Fields not provided will be None.
    This parser is RFC 3986 and RFC 6874 compliant.

    The parser logic and helper functions are based heavily on
    work done in the ``rfc3986`` module.

    :param str url: URL to parse into a :class:`.Url` namedtuple.

    Partly backwards-compatible with :mod:`urllib.parse`.

    Example:

    .. code-block:: python

        import urllib3

        print( urllib3.util.parse_url('http://google.com/mail/'))
        # Url(scheme='http', host='google.com', port=None, path='/mail/', ...)

        print( urllib3.util.parse_url('google.com:80'))
        # Url(scheme=None, host='google.com', port=80, path=None, ...)

        print( urllib3.util.parse_url('/foo?bar'))
        # Url(scheme=None, host=None, port=None, path='/foo', query='bar', ...)
    z//Nrr9)NNNri��)rr r!r"r$r%r&)r�
_SCHEME_REr|�_URI_RErNr�r(ry�
rpartition�
_HOST_PORT_RErI�_USERINFO_CHARS�intrrqror�r��_FRAGMENT_CHARS�
ValueError�AttributeError)r;�
source_urlrr8r$r%r&�
normalize_urir �_�	host_portr!r"�port_int�er
r
r�	parse_urlqsl

�
��



�
���r�)rDr3rErFr.r3)rDrKrErFr.rK)rDrrErFr.r)r$r3r.r3)r!rKrrr.rK)r!r3rrr.r3)r!rrrr.r)r�r3r.r�)r�r3r.r3)r;r3r.r)6�
__future__r�re�typing�
exceptionsr�utilrry�compilerSr��UNICODE�DOTALLr��	_IPV4_PAT�_HEX_PAT�format�	_LS32_PATr�_variations�_UNRESERVED_PATrk�	_IPV6_PAT�_ZONE_ID_PAT�_IPV6_ADDRZ_PAT�
_REG_NAME_PATr�r�_IPV6_RErz�_BRACELESS_IPV6_ADDRZ_REr{�_HOST_PORT_PATr��setr~�_SUB_DELIM_CHARSr�r�r�r��
NamedTuple�Optionalr3r�r�overloadrIrorqrvr�r�r
r
r
r�<module>s�


�	

��
���

$