????

Your IP : 216.73.216.152


Current Path : /usr/lib/python2.7/site-packages/pip/_vendor/urllib3/packages/rfc3986/
Upload File :
Current File : //usr/lib/python2.7/site-packages/pip/_vendor/urllib3/packages/rfc3986/parseresult.pyc

�
}�\]c@s�dZddlmZddlmZddlmZddlmZddlmZddlmZdZ	dZ
defd��YZd	ed	e
�efd��YZ
d
ed
e
�efd��YZd�Zd�ZdS(s3Module containing the urlparse compatibility logic.i����(t
namedtuplei(tcompat(t
exceptions(tmisc(tnormalizers(turitParseResulttParseResultBytestschemetuserinfothosttporttpathtquerytfragmenttParseResultMixincBsGeZd�Zd�Zed��Zed��Zed��ZRS(cs��fd�dD�\}}}|j|ksL|j|ksL|j|kr�|rddj|�}ntjtj||j�tj||j�|f�S|j	S(Nc3s|]}�|VqdS(N((t.0tp(t
attributes(sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pys	<genexpr>"sR	R
Rs{0}(suserinfoshostsport(
R	R
RtformatRtnormalize_authorityRtto_strtencodingt	authority(tselfRR	R
R((RsO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pyt_generate_authoritys
cCs
|j�S(s*Shim to match the standard library method.(tunsplit(R((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pytgeturl0scCs|jS(s#Shim to match the standard library.(R
(R((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pythostname4scCs|jS(s#Shim to match the standard library.(R(R((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pytnetloc9scCs|jS(s#Shim to match the standard library.(R
(R((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pytparams>s(t__name__t
__module__RRtpropertyRRR(((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pyRs
		c
Bs�eZdZd	Zdd�Zed
d
d
d
d
d
d
dd��Zedeed��Z	e
d��Zej
ej
ej
ej
ej
ej
ej
d�Zd
d�Zed�ZRS(s�Implementation of urlparse compatibility class.

    This uses the URIReference logic to handle compatibility with the
    urlparse.ParseResult class.
    sutf-8c

Cs[tt|�j||pd|p$d||p0d|p9d||�}
|	|
_||
_|
S(sCreate a new ParseResult.N(tsuperRt__new__tNoneRt	reference(tclsRR	R
RRR
Rturi_refRtparse_result((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pyR#Ns							c	Cs�d}	|dk	r#|	|d7}	n|dk	r<|	|7}	n|dk	r^|	dj|�7}	ntjd|d|	d|d|d|d	|�j�}
t|
d
t�\}}}|d|
jd|d|d
|d|
jd|
j	d|
j
d|
d	|�	S(s-Create a ParseResult instance from its parts.tt@s:{0}RRRR
RRtstrictR	R
RR'N(R$RRtURIReferencet	normalizetauthority_fromtTrueRRR
R(R&RR	R
RRR
RRRR'((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pyt
from_parts^s.
			c	Cs�tjj||�}|s*|j�}nt||�\}}}|d|jd|d|d|d|jd|jd|jd|d	|�	S(
s�Parse a URI from the given unicode URI string.

        :param str uri_string: Unicode URI to be parsed into a reference.
        :param str encoding: The encoding of the string provided
        :param bool strict: Parse strictly according to :rfc:`3986` if True.
            If False, parse similarly to the standard library's urlparse
            function.
        :returns: :class:`ParseResult` or subclass thereof
        RR	R
RRR
RR'R(	RR,tfrom_stringR-R.RRR
R(	R&t
uri_stringRR+tlazy_normalizeR%R	R
R((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pyR1zs			cCs
|jjS(s Return the normalized authority.(R%R(R((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pyR�scCs�tt|||||||f�}i}	x?|D]7\}
}|tjkr^t||
�}n||	|
<q1W|j|	�}|jjd|	dd|d|	dd|	dd|	d�}
td|
d|j	|	�S(s>Create a copy of this instance replacing with specified parts.RRRR
RR'R(
tziptPARSED_COMPONENTSRtUseExistingtgetattrRR%t	copy_withRR(RRR	R
RRR
RRt
attrs_dicttnametvalueRtref((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pyR8�s


csM�p|j�ttt�fd�|D���}td|jd�|�S(s+Convert to an instance of ParseResultBytes.c3s3|])}t|d�r'|j��n|VqdS(tencodeN(thasattrR=(Rtattr(R(sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pys	<genexpr>�sR'R(RtdictR4R5RR%(RRtattrs((RsO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pyR=�s	cCs[|}|rN|jrN|jjd�}|j|j�}|jd|�}n|jj�S(s�Create a URI string from the components.

        :returns: The parsed URI reconstituted as a string.
        :rtype: str
        tidnaR
(R
R=tdecodeRR8R%R(Rtuse_idnaR(t	hostbytesR
((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pyR�s(N(RR t__doc__tslotsR#tclassmethodR$R0R/R1R!RRR6R8R=tFalseR(((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pyRDs 
cBs�eZdZded�Zedddddddded�	�Zedeed��Ze	d��Z
ejejejejejejejed�Z
ed�ZRS(	s<Compatibility shim for the urlparse.ParseResultBytes object.sutf-8cCsptt|�j||pd|p$d||p0d|p9d|pBd|pKd�}|	|_||_|
|_|S(s'Create a new ParseResultBytes instance.N(R"RR#R$RR%R3(R&RR	R
RRR
RR'RR3R(((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pyR#�s								c

CsFd}
|dk	r#|
|d7}
n|dk	r<|
|7}
n|dk	rd|
djt|��7}
ntjd|d|
d|d|d|d	|�}|	s�|j�}ntj}t|d
t	�\}}}|d|||�d|||�d|||�d
|d|||�d|||�d|||�d|d	|d|	�
S(s-Create a ParseResult instance from its parts.R)R*s:{0}RRRR
RRR+R	R
RR'R3N(
R$RtintRR,R-Rtto_bytesR.R/(
R&RR	R
RRR
RRR3RR'RK((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pyR0�s6
		c
Cs�tjj||�}|s*|j�}nt||�\}}}tj}	|d|	|j|�d|	||�d|	||�d|d|	|j|�d|	|j	|�d|	|j
|�d|d	|d
|�
S(s�Parse a URI from the given unicode URI string.

        :param str uri_string: Unicode URI to be parsed into a reference.
        :param str encoding: The encoding of the string provided
        :param bool strict: Parse strictly according to :rfc:`3986` if True.
            If False, parse similarly to the standard library's urlparse
            function.
        :returns: :class:`ParseResultBytes` or subclass thereof
        RR	R
RRR
RR'RR3(RR,R1R-R.RRKRRR
R(
R&R2RR+R3R%R	R
RRK((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pyR1�s	cCs|jjj|j�S(s Return the normalized authority.(R%RR=R(R((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pyRsc	
Csett|||||||f�}	i}
xs|	D]k\}}|tjkr^t||�}nt|t�r�t|d�r�|j|j	�}n||
|<q1W|j
|
�}
tj}|j
jd||
d|j	�d||
|j	�d||
d|j	�d||
d|j	�d||
d|j	��}|sF|j�}ntd|d|j	d	||
�S(
s>Create a copy of this instance replacing with specified parts.R=RRRR
RR'RR3(R4R5RR6R7t
isinstancetbytesR>R=RRRRR%R8R-R(RRR	R
RRR
RR3RR9R:R;RRR<((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pyR8!s0		cCs�|}|rN|jrN|jj|j�}|jd�}|jd|�}n|jrl|jdt�}n|jj�}|j|j�S(s�Create a URI bytes object from the components.

        :returns: The parsed URI reconstituted as a string.
        :rtype: bytes
        RBR
R3(	R
RCRR=R8R3RIR%R(RRDR(R
RER((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pyRAs	N(RR RFR/R#RHR$R0R1R!RRR6R8RIR(((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pyR�scCs�d}}}d}|}d|krA|jdd�\}}n|jd�ru|jdd�\}}|d7}nd|kr�|jdd�\}}n|r�|r�|}n|r�|r�|}n|||fS(NR*it[t]t:(R$trsplitt
startswithtsplit(RR	R
Rt
extra_hosttrest((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pytsplit_authorityTs

	
	cs�y|j��Wn8tjk
rJ|r/�nt|j�\}}}n X�fd�dD�\}}}|r�yt|�}Wq�tk
r�tj|��q�Xn|||fS(Nc3s|]}�j|�VqdS(N(tget(RR(tsubauthority(sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pys	<genexpr>ysR	R
R(suserinfoshostsport(tauthority_infoRtInvalidAuthorityRVRRJt
ValueErrortInvalidPort(R%R+R	R
R((RXsO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pyR.os
N(sParseResultsParseResultBytes(sschemesuserinfoshostsportspathsquerysfragment(RFtcollectionsRR)RRRRRt__all__R5tobjectRRRRVR.(((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/parseresult.pyt<module>s &��