Your IP : 18.226.94.24


Current Path : /lib64/python3.6/urllib/__pycache__/
Upload File :
Current File : //lib64/python3.6/urllib/__pycache__/parse.cpython-36.opt-2.pyc

3

�me���@sNddlZddlZddlZdddddddd	d
ddd
dddddddddgZdddddddddd d!d"d#d$d%d&d'd(d)gZdddddd*dddd!dd d+d"d#d$d,d&d'd%d-d.d/d(d)gZddd0d"dddd d#d$d1d2d!d%d3gZdd0d4d5d*ddd+d1d2g
Zdddddd d!dd#d$d1d2gZddd0ddd5dddd d+dd"g
Z	d6Z
d7Zd8ZiZ
d9d:�Zd;Zd<Zd=d>�Zeefd?d@�ZeefdAdB�ZdCdD�ZGdEdF�dFe�ZGdGdH�dHe�ZGdIdJ�dJe�ZGdKdL�dLee�ZGdMdN�dNee�ZddOlmZeddP�ZeddQ�ZeddR�ZdSe_dTej _dUej!_dVe_dWej"_dXej#_dYej$_dZej%_d[ej!_d\e_ej"jej"_ej#jej#_ej$jej$_d]ej&_ej%jej%_ej!jej!_eZ'Gd^d�dee�Z(Gd_d�dee�Z)Gd`d�dee�Z*Gdad�dee�Z+Gdbd�dee�Z,Gdcd�dee�Z-ddde�Z.e.�[.d�dgd�Z/dhdi�Z0d�djdk�Z1dldm�Z2d�dnd�Z3dod�Z4dpd�Z5d�dqd�Z6drd�Z7dsZ8da9dtd�Z:ej;du�Z<d�dxd�Z=d�dzd	�Z>d�d{d
�Z?d�d|d�Z@eAd}�ZBeCeB�ZDiZEGd~d�dejF�ZGd�d�d�ZHd�d�d�ZId�d�d
�ZJdydddeIfd�d�ZKd�d��ZLd�d��ZMdaNd�d��ZOdaPd�d��ZQd�d��ZRd�d��ZSdaTd�d��ZUd�d�d��ZVd�d��ZWd�d��ZXd�d��ZYd�d��ZZdS)��N�urlparse�
urlunparse�urljoin�	urldefrag�urlsplit�
urlunsplit�	urlencode�parse_qs�	parse_qsl�quote�
quote_plus�quote_from_bytes�unquote�unquote_plus�unquote_to_bytes�DefragResult�ParseResult�SplitResult�DefragResultBytes�ParseResultBytes�SplitResultBytes�Zftp�httpZgopherZnntpZimapZwais�fileZhttpsZshttpZmmsZprosperoZrtspZrtspuZsftpZsvnzsvn+sshZwsZwssZtelnetZsnewsZrsyncZnfsZgitzgit+sshZhdlZsipZsipsZtelZmailtoZnewszAabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-.z!	

 �cCstj�tj�dS)N)�_parse_cache�clear�
_safe_quoters�rr�$/usr/lib64/python3.6/urllib/parse.py�clear_cache[sr �ascii�strictcCs|S)Nr)�objrrr�_noopjsr$cCs|j||�S)N)�encode)r#�encoding�errorsrrr�_encode_resultmsr(cst��fdd�|D��S)Nc3s"|]}|r|j���ndVqdS)rN)�decode)�.0�x)r&r'rr�	<genexpr>ssz_decode_args.<locals>.<genexpr>)�tuple)�argsr&r'r)r&r'r�_decode_argsqsr/cGsZt|dt�}x.|dd�D]}|rt|t�|krtd��qW|rL|tfSt|�tfS)Nr�z$Cannot mix str and non-str arguments)�
isinstance�str�	TypeErrorr$r/r()r.Z	str_input�argrrr�_coerce_argsus
r5c@seZdZfZddd�ZdS)�_ResultMixinStrr!r"cs|j��fdd�|D��S)Nc3s|]}|j���VqdS)N)r%)r*r+)r&r'rrr,�sz)_ResultMixinStr.encode.<locals>.<genexpr>)�_encoded_counterpart)�selfr&r'r)r&r'rr%�sz_ResultMixinStr.encodeN)r!r")�__name__�
__module__�__qualname__�	__slots__r%rrrrr6�sr6c@seZdZfZddd�ZdS)�_ResultMixinBytesr!r"cs|j��fdd�|D��S)Nc3s|]}|j���VqdS)N)r))r*r+)r&r'rrr,�sz+_ResultMixinBytes.decode.<locals>.<genexpr>)�_decoded_counterpart)r8r&r'r)r&r'rr)�sz_ResultMixinBytes.decodeN)r!r")r9r:r;r<r)rrrrr=�sr=c@s@eZdZfZedd��Zedd��Zedd��Zedd��Zd	S)
�_NetlocResultMixinBasecCs
|jdS)Nr)�	_userinfo)r8rrr�username�sz_NetlocResultMixinBase.usernamecCs
|jdS)Nr0)r@)r8rrr�password�sz_NetlocResultMixinBase.passwordcCsD|jd}|sdSt|t�r dnd}|j|�\}}}|j�||S)Nr�%�%)�	_hostinfor1r2�	partition�lower)r8�hostnameZ	separatorZpercentZzonerrrrH�s
z_NetlocResultMixinBase.hostnamecCs@|jd}|dk	r<t|d�}d|ko.dkns<td��|S)Nr0�
ri��zPort out of range 0-65535)rE�int�
ValueError)r8�portrrrrL�s

z_NetlocResultMixinBase.portN)	r9r:r;r<�propertyrArBrHrLrrrrr?�s
r?c@s(eZdZfZedd��Zedd��ZdS)�_NetlocResultMixinStrcCsD|j}|jd�\}}}|r4|jd�\}}}|s<d}nd}}||fS)N�@�:)�netloc�
rpartitionrF)r8rQ�userinfo�	have_info�hostinforA�
have_passwordrBrrrr@�sz_NetlocResultMixinStr._userinfocCsl|j}|jd�\}}}|jd�\}}}|rL|jd�\}}}|jd�\}}}n|jd�\}}}|sdd}||fS)NrO�[�]rP)rQrRrF)r8rQ�_rU�have_open_br�	bracketedrHrLrrrrE�sz_NetlocResultMixinStr._hostinfoN)r9r:r;r<rMr@rErrrrrN�srNc@s(eZdZfZedd��Zedd��ZdS)�_NetlocResultMixinBytescCsD|j}|jd�\}}}|r4|jd�\}}}|s<d}nd}}||fS)N�@�:)rQrRrF)r8rQrSrTrUrArVrBrrrr@�sz!_NetlocResultMixinBytes._userinfocCsl|j}|jd�\}}}|jd�\}}}|rL|jd�\}}}|jd�\}}}n|jd�\}}}|sdd}||fS)Nr]�[�]r^)rQrRrF)r8rQrYrUrZr[rHrLrrrrE�sz!_NetlocResultMixinBytes._hostinfoN)r9r:r;r<rMr@rErrrrr\�sr\)�
namedtuplezurl fragmentz!scheme netloc path query fragmentz(scheme netloc path params query fragmentz�
DefragResult(url, fragment)

A 2-tuple that contains the url without fragment identifier and the fragment
identifier as a separate argument.
z$The URL with no fragment identifier.z�
Fragment identifier separated from URL, that allows indirect identification of a
secondary resource by reference to a primary resource and additional identifying
information.
z�
SplitResult(scheme, netloc, path, query, fragment)

A 5-tuple that contains the different components of a URL. Similar to
ParseResult, but does not split params.
z%Specifies URL scheme for the request.z0
Network location where the request is made to.
z@
The hierarchical path, such as the path to a file to download.
z�
The query component, that contains non-hierarchical data, that along with data
in path component, identifies a resource in the scope of URI's scheme and
network location.
z�
Fragment identifier, that allows indirect identification of a secondary resource
by reference to a primary resource and additional identifying information.
zr
ParseResult(scheme, netloc, path, params,  query, fragment)

A 6-tuple that contains components of a parsed URL.
z�
Parameters for last path element used to dereference the URI in order to provide
access to perform some operation on the resource.
c@seZdZfZdd�ZdS)rcCs |jr|jd|jS|jSdS)N�#)�fragment�url)r8rrr�geturl@szDefragResult.geturlN)r9r:r;r<rerrrrr>sc@seZdZfZdd�ZdS)rcCst|�S)N)r)r8rrrreHszSplitResult.geturlN)r9r:r;r<rerrrrrFsc@seZdZfZdd�ZdS)rcCst|�S)N)r)r8rrrreMszParseResult.geturlN)r9r:r;r<rerrrrrKsc@seZdZfZdd�ZdS)rcCs |jr|jd|jS|jSdS)N�#)rcrd)r8rrrreSszDefragResultBytes.geturlN)r9r:r;r<rerrrrrQsc@seZdZfZdd�ZdS)rcCst|�S)N)r)r8rrrre[szSplitResultBytes.geturlN)r9r:r;r<rerrrrrYsc@seZdZfZdd�ZdS)rcCst|�S)N)r)r8rrrre`szParseResultBytes.geturlN)r9r:r;r<rerrrrr^scCs8ttfttfttff}x|D]\}}||_||_qWdS)N)rrrrrrr7r>)Z
_result_pairsZ_decodedZ_encodedrrr�_fix_result_transcodingds
rgTc
Csft||�\}}}t|||�}|\}}}}}|tkrHd|krHt|�\}}nd}t||||||�}	||	�S)N�;r)r5r�uses_params�_splitparamsr)
rd�scheme�allow_fragments�_coerce_resultZsplitresultrQ�queryrc�params�resultrrrrqscCsRd|kr,|jd|jd��}|dkr6|dfSn
|jd�}|d|�||dd�fS)N�/rhrrr0)�find�rfind)rd�irrrrj�s

rjcCsLt|�}x*dD]"}|j||�}|dkrt||�}qW|||�||d�fS)Nz/?#r)�lenrr�min)rd�start�delim�cZwdelimrrr�_splitnetloc�s
rzcCs�|stdd�|D��rdSddl}|jdd�}|jdd�}|jdd�}|jdd�}|jd	|�}||krndSx(d
D] }||krttd|dd
��qtWdS)Ncss|]}t|�dkVqdS)�N)�ord)r*ryrrrr,�sz_checknetloc.<locals>.<genexpr>rrOrrPrb�?�NFKCz/?#@:znetloc 'z' contains invalid z#characters under NFKC normalization)�any�unicodedata�replace�	normalizerK)rQr��nZnetloc2ryrrr�_checknetloc�s
r�c
Cs�t||�\}}}|jt�}|jt�}t|�}|||t|�t|�f}tj|d�}|rZ||�Stt�t	krlt
�d}}}|jd�}	|	dk�r�|d|	�dk�rj|d|	�j�}||	dd�}|dd�dk�rt
|d�\}}d|kr�d	|kp�d	|ko�d|k�rtd
��|�r(d|k�r(|jdd�\}}d|k�rB|jdd�\}}t|�t|||||�}
|
t|<||
�Sxd|d|	�D]}|tk�rxP�qxW||	dd�}|�s�td
d�|D���r�|d|	�j�|}}|dd�dk�r t
|d�\}}d|k�rd	|k�sd	|k�r d|k�r td
��|�r@d|k�r@|jdd�\}}d|k�rZ|jdd�\}}t|�t|||||�}
|
t|<||
�S)NrrPrrr0�z//rWrXzInvalid IPv6 URLrbr}css|]}|dkVqdS)�
0123456789Nr)r*ryrrrr,�szurlsplit.<locals>.<genexpr>)r5�lstrip�_WHATWG_C0_CONTROL_OR_SPACE�strip�bool�typer�getru�MAX_CACHE_SIZEr rrrGrzrK�splitr�r�scheme_charsr)
rdrkrlrm�key�cachedrQrnrcrt�vry�restrrrr�s`






cCs<t|�\}}}}}}}|r&d||f}|t|||||f��S)Nz%s;%s)r5r)�
componentsrkrQrdrornrcrmrrrr�scCs�t|�\}}}}}}|s4|r`|tkr`|dd�dkr`|rP|dd�dkrPd|}d|pXd|}|rp|d|}|r�|d|}|r�|d|}||�S)	Nr�z//r0rqrrPr}rb)r5�uses_netloc)r�rkrQrdrnrcrmrrrr�s cCs�|s|S|s|St||�\}}}t|d|�\}}}}}}	t|||�\}
}}}
}}|
|ks`|
tkrh||�S|
tkr�|r�|t|
|||
||f��S|}|r�|
r�|}|}
|s�|}|t|
|||
||f��S|jd�}|ddkr�|d=|dd�dk�r�|jd�}n(||jd�}td|dd��|dd	�<g}xX|D]P}|dk�rdy|j�Wntk
�r`YnXn|dk�rt�q0n
|j	|��q0W|d
dk�r�|j	d�|t|
|dj
|��p�d|
||f��S)Nrrqr0�..�.���r�r�r�r�)r�r�)r5r�
uses_relativer�rr��filter�pop�
IndexError�append�join)�baserdrlrmZbschemeZbnetlocZbpathZbparamsZbqueryZ	bfragmentrkrQ�pathrornrcZ
base_partsZsegmentsZ
resolved_pathZsegrrrrsT






c	CsTt|�\}}d|kr>t|�\}}}}}}t|||||df�}nd}|}|t||��S)Nrbr)r5rrr)	rdrm�sr��p�a�qZfragZdefragrrrrEsZ0123456789ABCDEFabcdefcCs�|s|jdSt|t�r"|jd�}|jd�}t|�dkr<|S|dg}|j}tdkrbdd�tD�axb|dd�D]R}y(|t|dd��||dd��Wqptk
r�|d�||�YqpXqpWdj	|�S)	N�zutf-8rDr0rcSs4i|],}tD]"}tt||d�g�||j��qqS)�)�_hexdig�bytesrJr%)r*r��brrr�
<dictcomp>ksz$unquote_to_bytes.<locals>.<dictcomp>r�)
r�r1r2r%rur��
_hextobyter��KeyErrorr�)�string�bits�resr��itemrrrrXs*



z([-]+)�utf-8r�cCs�d|kr|j|S|dkrd}|dkr*d}tj|�}|dg}|j}x@tdt|�d�D],}|t||�j||��|||d�qVWdj|�S)NrCzutf-8r�rr0r�r)r��_asciirer��rangerurr)r�)r�r&r'r�r�r�rtrrrrxs


Fc
CsPi}t||||||d�}x2|D]*\}}	||kr>||j|	�q|	g||<qW|S)N)r&r'�max_num_fields)r
r�)
�qs�keep_blank_values�strict_parsingr&r'r�Z
parsed_result�pairs�name�valuerrrr	�scCst|�\}}|dk	r<d|jd�|jd�}||kr<td��dd�|jd�D�}g}	x�|D]�}
|
rl|rlqZ|
jdd�}t|�dkr�|r�td	|
f��|rZ|jd
�nqZt|d�s�|rZ|djdd
�}t|||d�}||�}|djdd
�}
t|
||d�}
||
�}
|	j||
f�qZW|	S)Nr0�&rhzMax number of fields exceededcSs g|]}|jd�D]}|�qqS)rh)r�)r*�s1�s2rrr�
<listcomp>�szparse_qsl.<locals>.<listcomp>�=r�zbad query field: %rrr�+� )r&r')r5�countrKr�rur�r�r)r�r�r�r&r'r�rm�
num_fieldsr��rZ
name_valueZnvr�r�rrrr
�s4
cCs|jdd�}t|||�S)Nr�r�)r�r)r�r&r'rrrr�ssAABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-c@s$eZdZdd�Zdd�Zdd�ZdS)�QuotercCstj|�|_dS)N)�_ALWAYS_SAFE�union�safe)r8r�rrr�__init__
szQuoter.__init__cCsd|jjt|�fS)Nz<%s %r>)�	__class__r9�dict)r8rrr�__repr__szQuoter.__repr__cCs(||jkrt|�ndj|�}|||<|S)Nz%{:02X})r��chr�format)r8r�r�rrr�__missing__szQuoter.__missing__N)r9r:r;r�r�r�rrrrr�sr�rqcCsbt|t�r8|s|S|dkrd}|dkr*d}|j||�}n |dk	rHtd��|dk	rXtd��t||�S)Nzutf-8r"z,quote() doesn't support 'encoding' for bytesz*quote() doesn't support 'errors' for bytes)r1r2r%r3r
)r�r�r&r'rrrrs
cCsdt|t�rd|ks$t|t�r2d|kr2t||||�St|t�rBd}nd}t|||||�}|jdd�S)Nr�� r�)r1r2r�rr�)r�r�r&r'ZspacerrrrGs
cs�t|ttf�std��|sdSt|t�r6|jdd�}ntdd�|D��}|jt|�s^|j�Syt	|�Wn&t
k
r�t|�jt	|<�YnXdj
�fdd�|D��S)Nz!quote_from_bytes() expected bytesrr!�ignorecSsg|]}|dkr|�qS)�r)r*ryrrrr�esz$quote_from_bytes.<locals>.<listcomp>csg|]}�|��qSrr)r*�char)�quoterrrr�ls)r1r��	bytearrayr3r2r%�rstrip�_ALWAYS_SAFE_BYTESr)rr�r��__getitem__r�)Zbsr�r)r�rr
Xs
cCst|d�r|j�}nRy t|�r2t|dt�r2t�Wn0tk
rdtj�\}}}td�j|��YnXg}	|s�xr|D]j\}
}t|
t	�r�||
|�}
n|t
|
�|||�}
t|t	�r�|||�}n|t
|�|||�}|	j|
d|�qtW�n,�x(|D�]\}
}t|
t	��r||
|�}
n|t
|
�|||�}
t|t	��rL|||�}|	j|
d|�q�t|t
��rz|||||�}|	j|
d|�q�yt|�}Wn:tk
�r�|t
|�|||�}|	j|
d|�Yq�XxJ|D]B}
t|
t	��r�||
|�}
n|t
|
�|||�}
|	j|
d|
��q�Wq�Wdj|	�S)N�itemsrz1not a valid non-string sequence or mapping objectr�r�)
�hasattrr�rur1r-r3�sys�exc_info�with_tracebackr�r2r�r�)rnZdoseqr�r&r'Z	quote_viaZtyZva�tb�l�kr�r+ZeltrrrrnsP





cCsJt|t�rFy|jd�j�}Wn(tk
rDtdt|�d��YnX|S)N�ASCIIzURL z contains non-ASCII characters)r1r2r%r)�UnicodeError�repr)rdrrr�to_bytes�s
r�cCs`t|�j�}|dd�dkr<|dd�dkr<|dd�j�}|dd�dkr\|dd�j�}|S)Nr0�<�>�zURL:r�r�)r2r�)rdrrr�unwrap�s r�cCsDtdkrtjdtj�atj|�}|r<|j�\}}|j�|fSd|fS)Nz
([^/:]+):(.*))�	_typeprog�re�compile�DOTALL�match�groupsrG)rdr�rk�datarrr�	splittype�s
r�cCsXtdkrtjdtj�atj|�}|rP|j�\}}|rH|ddkrHd|}||fSd|fS)Nz//([^/#?]*)(.*)rrq)�	_hostprogr�r�r�r�r�)rdr�Z	host_portr�rrr�	splithost�s
r�cCs |jd�\}}}|r|nd|fS)NrO)rR)�host�userrxrrr�	splituser�sr�cCs |jd�\}}}||r|ndfS)NrP)rF)r�rxZpasswdrrr�splitpasswd�sr�cCsDtdkrtjdtj�atj|�}|r<|j�\}}|r<||fS|dfS)Nz(.*):([0-9]*)$)�	_portprogr�r�r�r�r�)r�r�rLrrr�	splitport�s
r�r0cCsT|jd�\}}}|s|}n2|rLyt|�}Wntk
rBd}YnX||fS||fS)NrP)rRrJrK)r�ZdefportrxrLZnportrrr�
splitnports
r�cCs$|jd�\}}}|r||fS|dfS)Nr})rR)rdr�rxrnrrr�
splitquerysr�cCs$|jd�\}}}|r||fS|dfS)Nrb)rR)rdr�rx�tagrrr�splittagsr�cCs|jd�}|d|dd�fS)Nrhrr0)r�)rdZwordsrrr�	splitattr&s
r�cCs |jd�\}}}||r|ndfS)Nr�)rF)�attrrxr�rrr�
splitvalue,sr�)rT)r)rT)T)r�r�)FFr�r�N)FFr�r�N)r�r�)rqNN)rNN)rqr�)r�)[r�r��collections�__all__r�r�riZnon_hierarchicalZ
uses_queryZ
uses_fragmentr�r�r�rr Z_implicit_encodingZ_implicit_errorsr$r(r/r5�objectr6r=r?rNr\raZ_DefragResultBaseZ_SplitResultBaseZ_ParseResultBase�__doc__rdrcrkrQr�rnroZ
ResultBaserrrrrrrgrrjrzr�rrrrrr�r�rr�r�rr	r
r�	frozensetr�r�r�r�defaultdictr�rrr
rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr�<module>"s�




!


	

>
E


&
;
	
,

O