????

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/normalizers.pyc

�
}�\]c@s�dZddlZddlmZddlmZd�Zd�Zd�Zd	�Zd
�Z	d�Z
d�Zd
�Zej
d�Zd�Zd�Zd�ZdS(s.Module with functions to normalize components.i����Ni(tcompat(tmisccCs
|j�S(sNormalize the scheme component.(tlower(tscheme((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/normalizers.pytnormalize_schemescCsf|\}}}d}|r2|t|�d7}n|rK|t|�7}n|rb|d|7}n|S(s)Normalize an authority tuple to a string.tt@t:(tnormalize_percent_characterstnormalize_host(t	authoritytuserinfothosttporttresult((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/normalizers.pytnormalize_authorityscCs
tj|�S(s<Normalize a username to make it safe to include in userinfo.(Rturlquote(tusername((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/normalizers.pytnormalize_username(scCs
tj|�S(s/Normalize a password to make safe for userinfo.(RR(tpassword((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/normalizers.pytnormalize_password-scCs�tjj|�r�|jd�}|dkr�|jd�}|dksv||ksv||kr�|t|�dkr�|jddd�}n|| j�||Sn|j�S(sNormalize a host string.t%i����s%25ii(RtIPv6_MATCHERtmatchtfindtlentreplaceR(Rtpercentt
percent_25((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/normalizers.pyR	2s"cCs |s
|St|�}t|�S(sNormalize the path string.(Rtremove_dot_segments(tpath((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/normalizers.pytnormalize_pathFscCs|s
|St|�S(sNormalize the query string.(R(tquery((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/normalizers.pytnormalize_queryOscCs|s
|St|�S(sNormalize the fragment string.(R(tfragment((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/normalizers.pytnormalize_fragmentVss%[A-Fa-f0-9]{2}cCsQttj|��}x5|D]-}|j�s|j||j��}qqW|S(s�All percent characters should be upper-cased.

    For example, ``"%3afoo%DF%ab"`` should be turned into ``"%3Afoo%DF%AB"``.
    (tsettPERCENT_MATCHERtfindalltisupperRtupper(tstmatchestm((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/normalizers.pyR`s

cCs�|jd�}g}xO|D]G}|dkr4qq|dkrP|j|�q|r|j�qqW|jd�r�|s�|dr�|jdd�n|jd�r�|jd�ndj|�S(	sURemove dot segments from the string.

    See also Section 5.2.4 of :rfc:`3986`.
    t/t.s..iRs/.s/..(s/.s/..(tsplittappendtpopt
startswithtinserttendswithtjoin(R)tsegmentstoutputtsegment((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/normalizers.pyRls
 c	Cs|dkr|Sttjtj||���}tj||�}||jd�k}t�}x�t	dt|��D]�}|||d!}t
|�}|r�|dks�|dkr�|j�tj
kr�|j|�qwn|jdj|�j�j��qwW|j|�S(s7Encode the specific component in the provided encoding.Riii�s%{0:02x}N(tNoneRR%R&Rtto_strtto_bytestcountt	bytearraytrangetordtdecodeRtNON_PCT_ENCODEDtextendtformattencodeR((	t
uri_componenttencodingtpercent_encodingst	uri_bytestis_percent_encodedtencoded_urititbytetbyte_ord((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/normalizers.pytencode_component�s 		!
&(t__doc__treRRRRRRRR	RR!R#tcompileR%RRRM(((sO/tmp/pip-install-ewDPok/pip/pip/_vendor/urllib3/packages/rfc3986/normalizers.pyt<module>s		
									"