AlkantarClanX12

Your IP : 3.12.34.150


Current Path : /proc/self/root/lib/python3.6/site-packages/urllib3/util/__pycache__/
Upload File :
Current File : //proc/self/root/lib/python3.6/site-packages/urllib3/util/__pycache__/url.cpython-36.pyc

3

h��f��@s�ddlmZddlmZddlZddlmZddlmZddd	d
ddd
gZ	dZ
ejd�ZGdd�dede	��Z
dd�Zdd�Zdd�ZdS)�)�absolute_import)�
namedtupleN�)�LocationParseError)�quote�scheme�auth�host�port�path�query�fragment�http�httpsz[- ]cs^eZdZdZfZd�fdd�	Zedd��Zedd��Zed	d
��Z	edd��Z
d
d�Z�ZS)�Urlz�
    Datastructure 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.
    Nc	sV|r|jd�rd|}|r$|j�}|r8|tkr8|j�}tt|�j||||||||�S)N�/)�
startswith�lower�NORMALIZABLE_SCHEMES�superr�__new__)�clsrrr	r
rrr
)�	__class__��/usr/lib/python3.6/url.pyrszUrl.__new__cCs|jS)z@For backwards-compatibility with urlparse. We're nice like that.)r	)�selfrrr�hostname%szUrl.hostnamecCs&|jpd}|jdk	r"|d|j7}|S)z)Absolute path including the query string.rN�?)rr)rZurirrr�request_uri*s

zUrl.request_uricCs|jrd|j|jfS|jS)z(Network location including host and portz%s:%d)r
r	)rrrr�netloc4sz
Url.netlocc	Cs�|\}}}}}}}d}|dk	r*||d7}|dk	r>||d7}|dk	rN||7}|dk	rf|dt|�7}|dk	rv||7}|dk	r�|d|7}|dk	r�|d|7}|S)a�
        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: ::

            >>> U = parse_url('http://google.com/mail/')
            >>> U.url
            'http://google.com/mail/'
            >>> Url('http', 'username:password', 'host.com', 80,
            ... '/path', 'query', 'fragment').url
            'http://username:password@host.com:80/path?query#fragment'
        �Nz://�@�:r�#)�str)	rrrr	r
rrr
�urlrrrr%;s"zUrl.urlcCs|jS)N)r%)rrrr�__str__cszUrl.__str__)NNNNNNN)
�__name__�
__module__�__qualname__�__doc__�	__slots__r�propertyrrrr%r&�
__classcell__rr)rrrs

(rcCszd}d}x8|D]0}|j|�}|dkr&q|dks6||kr|}|}qW|dksR|dkr\|ddfS|d|�||dd�|fS)a�
    Given a string and an iterable of delimiters, split on the first found
    delimiter. Return two split parts and the matched delimiter.

    If not found, then the first part is the full input string.

    Example::

        >>> split_first('foo/bar?baz', '?/=')
        ('foo', 'bar?baz', '/')
        >>> split_first('foo/bar?baz', '123')
        ('foo/bar?baz', '', None)

    Scales linearly with number of delims. Not ideal for large number of delims.
    Nrr �)�find)�sZdelimsZmin_idxZ	min_delim�d�idxrrr�split_firstgs


r3cCs�|s
t�Stjdd�|�}d}d}d}d}d}d}d}d|krN|jdd�\}}t|dddg�\}}}	|	rp|	|}d	|kr�|jd	d�\}}|r�|d
dkr�|jdd�\}}|d7}d
|k�r|jd
d�\}
}|s�|
}|�r|j�s�t|��yt|�}Wnt	k
�rt|��YnXnd}n|�r.|�r.|}|�sHt|||||||�Sd|k�rb|jdd�\}}d|k�r||jdd�\}}t|||||||�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.

    Partly backwards-compatible with :mod:`urlparse`.

    Example::

        >>> parse_url('http://google.com/mail/')
        Url(scheme='http', host='google.com', port=None, path='/mail/', ...)
        >>> parse_url('google.com:80')
        Url(scheme=None, host='google.com', port=80, path=None, ...)
        >>> parse_url('/foo?bar')
        Url(scheme=None, host=None, port=None, path='/foo', query='bar', ...)
    cSst|j��S)N)r�group)�matchrrr�<lambda>�szparse_url.<locals>.<lambda>Nz://r.rrr#r!r�[�]r")
r�!_contains_disallowed_url_pchar_re�sub�splitr3�rsplit�isdigitr�int�
ValueError)r%rrr	r
rr
rZpath_ZdelimZ_hostrrr�	parse_url�sR


r@cCst|�}|jpd|j|jfS)z4
    Deprecated. Use :func:`parse_url` instead.
    r)r@rrr
)r%�prrr�get_host�srB)rrN)Z
__future__r�collectionsr�re�
exceptionsrZpackages.six.moves.urllib.parserZ	url_attrsr�compiler9rr3r@rBrrrr�<module>s
U!a