????

Your IP : 216.73.216.152


Current Path : /proc/self/root/proc/self/root/lib/python2.7/site-packages/pip/_vendor/urllib3/util/
Upload File :
Current File : //proc/self/root/proc/self/root/lib/python2.7/site-packages/pip/_vendor/urllib3/util/url.pyc

�
}�\]c@@sBddlmZddlZddlmZddlmZddlmZm	Z	ddl
mZmZddl
mZdd	lmZmZmZmZd
ddd
dddgZdZejd�ZejejBdddhBZedhBZZdede�fd��YZd�Zdd�Z d�Z!d�Z"dS( i(tabsolute_importN(t
namedtuplei(tLocationParseError(tsixtrfc3986(tRFC3986ExceptiontValidationError(t	Validator(tabnf_regexptnormalizerstcompattmisctschemetauththosttporttpathtquerytfragmentthttpthttpss^(?:[a-zA-Z][a-zA-Z0-9+\-]*:|/)t:t@t/t?tUrlcB@sweZdZdZdddddddd�Zed��Zed��Zed��Z	ed��Z
d�ZRS(	s�
    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.
    c
C@si|r#|jd�r#d|}n|dk	r>|j�}ntt|�j||||||||�S(NR(t
startswithtNonetlowertsuperRt__new__(tclsRR
RRRRR((s;/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/util/url.pyR!s
!cC@s|jS(s@For backwards-compatibility with urlparse. We're nice like that.(R(tself((s;/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/util/url.pythostname*scC@s6|jpd}|jdk	r2|d|j7}n|S(s)Absolute path including the query string.RRN(RRR(R turi((s;/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/util/url.pytrequest_uri/scC@s$|jrd|j|jfS|jS(s(Network location including host and ports%s:%d(RR(R ((s;/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/util/url.pytnetloc9s	c	C@s�|\}}}}}}}d}|dk	r>||d7}n|dk	r[||d7}n|dk	rt||7}n|dk	r�|dt|�7}n|dk	r�||7}n|dk	r�|d|7}n|dk	r�|d|7}n|S(s�
        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'
        uu://u@u:u?u#N(Rtstr(	R RR
RRRRRturl((s;/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/util/url.pyR&@s"

cC@s|jS(N(R&(R ((s;/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/util/url.pyt__str__hs(N(t__name__t
__module__t__doc__t	__slots__RRtpropertyR!R#R$R&R'(((s;/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/util/url.pyRs
(cC@s�d}d}xV|D]N}|j|�}|dkr:qn|dksR||kr|}|}qqW|dks}|dkr�|ddfS|| ||d|fS(s�
    .. deprecated:: 1.25

    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.
    itiN(Rtfind(tstdelimstmin_idxt	min_delimtdtidx((s;/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/util/url.pytsplit_firstls


sutf-8c
C@s|dkr|Sttjjtj||���}|jdd�}||jd�k}t	�}x�t
dt|��D]�}|||d!}t|�}	|r�|dks�|	dkr�|j�|kr�|j
|�qzn|j
dj|	�j�j��qzW|j|�S(	s�Percent-encodes a URI component without reapplying
    onto an already percent-encoded component. Based on
    rfc3986.normalizers.encode_component()
    sutf-8t
surrogatepasst%iii�s%{0:02x}N(RtlenR	tPERCENT_MATCHERtfindallR
tto_strtencodetcountt	bytearraytrangetordtdecodetextendtformattupper(
t	componentt
allowed_charstencodingtpercent_encodingst	uri_bytestis_percent_encodedtencoded_componenttitbytetbyte_ord((s;/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/util/url.pyt_encode_invalid_chars�s 	
&c	@sv|s
t�St|tj��tj|�s<d|}nd�}y�tjjt	j
|��j�}tj
|d|dt|dt�t|dt�t|dt��}|jdk	}|jd|�}Wn*ttfk
rtjt|�d�SX|r&|jdkr&t|��n|jdksJ|jj�tkrY|j�}nt�}y|j|j�j |�Wn$t!k
r�tjt|�d�SX|j"}|s�|j#dk	s�|j$dk	r�d	}q�d}n�fd
�}td||j�d||j%�d||j&�d
|j'dk	rEt(|j'�ndd||�d||j#�d||j$��S(s�
    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 compliant.

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

    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', ...)
    s//cS@s�|r�tg|D]}t|�dk^q�r�yddlm}Wntk
rdtd��nXy#|j|j�dtdt�SWq�|j	k
r�td|��q�Xn|S(Ni�i(tidnas-Unable to parse URL without the 'idna' moduletstrictt
std3_rulesu#Name '%s' is not a valid IDNA label(
tanyR@tpip._vendorRPtImportErrorRR<RtTruet	IDNAError(tnametxRP((s;/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/util/url.pytidna_encode�s1
#Rt	authorityRRRtidna_encoderR-c@s;|dkrdS�r7t|tj�r7|jd�S|S(Nsutf-8(Rt
isinstanceRtbinary_typeR<(RY(t	is_string(s;/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/util/url.pyt
to_input_type
s

R
RRN()RR]RR^tSCHEME_REGEXtsearchRtIRI_MATCHERtmatchR
R;t	groupdictRtIRIReferenceROt
PATH_CHARStQUERY_CHARStFRAGMENT_CHARSR[RR<t
ValueErrorRt
raise_fromRRRtNORMALIZABLE_SCHEMESt	normalizeRtcheck_validity_oftCOMPONENT_NAMEStvalidateRRRRtuserinfoRRtint(	R&RZt	split_iritiri_reft
has_authorityturi_reft	validatorRR`((R_s;/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/util/url.pyt	parse_url�sV
	!$	
			$cC@s(t|�}|jpd|j|jfS(s4
    Deprecated. Use :func:`parse_url` instead.
    R(RxRR!R(R&tp((s;/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/util/url.pytget_hosts(shttpshttpsN(#t
__future__RtretcollectionsRt
exceptionsRtpackagesRRtpackages.rfc3986.exceptionsRRtpackages.rfc3986.validatorsRtpackages.rfc3986RR	R
Rt	url_attrsRRltcompileRatUNRESERVED_CHARS_SETtSUB_DELIMITERS_SETRgRhRiRR5RORxRz(((s;/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/util/url.pyt<module>s""S	#	n