AlkantarClanX12

Your IP : 3.15.211.41


Current Path : /opt/alt/python34/lib64/python3.4/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/lib2to3/fixes/__pycache__/fix_urllib.cpython-34.pyo

�
i f� �@svdZddlmZmZddlmZddlmZmZm	Z	m
Z
mZmZm
Z
iddddd	d
ddd
gfddddddddddddddddgfddgfgd 6dd
d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7gfdd8d9gfgd:6Zed:jed d;�d<d=�ZGd>d?�d?e�Zd@S)Az�Fix changes imports of urllib which are now incompatible.
   This is rather similar to fix_imports, but because of the more
   complex nature of the fixing for urllib, it has its own fixer.
�)�
alternates�
FixImports)�
fixer_base)�Name�Comma�
FromImport�Newline�find_indentation�Node�symszurllib.requestZ	URLopenerZFancyURLopenerZurlretrieveZ
_urlopenerZurlopenZ
urlcleanupZpathname2urlZurl2pathnamezurllib.parseZquoteZ
quote_plusZunquoteZunquote_plusZ	urlencodeZ	splitattrZ	splithostZ
splitnportZsplitpasswdZ	splitportZ
splitqueryZsplittagZ	splittypeZ	splituserZ
splitvaluezurllib.errorZContentTooShortErrorZurllibZinstall_openerZbuild_openerZRequestZOpenerDirectorZBaseHandlerZHTTPDefaultErrorHandlerZHTTPRedirectHandlerZHTTPCookieProcessorZProxyHandlerZHTTPPasswordMgrZHTTPPasswordMgrWithDefaultRealmZAbstractBasicAuthHandlerZHTTPBasicAuthHandlerZProxyBasicAuthHandlerZAbstractDigestAuthHandlerZHTTPDigestAuthHandlerZProxyDigestAuthHandlerZHTTPHandlerZHTTPSHandlerZFileHandlerZ
FTPHandlerZCacheFTPHandlerZUnknownHandlerZURLErrorZ	HTTPErrorZurllib2�ccs�t�}x�tj�D]w\}}xh|D]`}|\}}t|�}d||fVd|||fVd|Vd|Vd||fVq)WqWdS)Nz�import_name< 'import' (module=%r
                                  | dotted_as_names< any* module=%r any* >) >
                  z�import_from< 'from' mod_member=%r 'import'
                       ( member=%s | import_as_name< member=%s 'as' any > |
                         import_as_names< members=any*  >) >
                  zIimport_from< 'from' module_star=%r 'import' star='*' >
                  ztimport_name< 'import'
                                  dotted_as_name< module_as=%r 'as' any > >
                  zKpower< bare_with_attr=%r trailer< '.' member=%s > any* >
                  )�set�MAPPING�itemsr)ZbareZ
old_moduleZchanges�changeZ
new_module�members�r�=/opt/alt/python34/lib64/python3.4/lib2to3/fixes/fix_urllib.py�
build_pattern1s	
		rc@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�	FixUrllibcCsdjt��S)N�|)�joinr)�selfrrrrJszFixUrllib.build_patterncCs�|jd�}|j}g}xEt|jdd�D],}|jt|dd|�t�g�q6W|jtt|jddd|��|j|�dS)z�Transform for the basic import case. Replaces the old
           import name with a comma separated list of its
           replacements.
        �moduleNrr�prefix���r)	�getrr�value�extendrr�append�replace)r�node�resultsZ
import_mod�pref�names�namerrr�transform_importMs	*(zFixUrllib.transform_importcCs�|jd�}|j}|jd�}|r�t|t�rI|d}nd}x6t|jD]'}|j|dkr]|d}Pq]q]W|r�|jt|d|��q�|j|d�n>g}i}	|d}
x�|
D]�}|j	t
jkr|jd	j}|jdj}n|j}d}|d
kr�xlt|jD]Z}||dkr>|d|	krx|j
|d�n|	j|dg�j
|�q>q>Wq�q�Wg}
t|�}d}dd
�}x�|D]�}|	|}g}x>|dd�D],}|j|||��|j
t��q�W|j||d|��t||�}|sj|jjj|�rv||_n|
j
|�d}q�W|
r�g}x.|
dd�D]}|j|t�g�q�W|j
|
d�|j|�n|j|d�dS)z�Transform for imports of specific module elements. Replaces
           the module to be imported from with the appropriate new
           module.
        �
mod_member�memberrNrrz!This is an invalid module elementr��,TcSsz|jtjkrdt|jdjd|�|jdj�|jdj�g}ttj|�gSt|jd|�gS)Nrrrr))�typer�import_as_namer�childrenrZcloner
)r%rZkidsrrr�handle_name�sz/FixUrllib.transform_member.<locals>.handle_nameFzAll module elements are invalidrrrr)rr�
isinstance�listrrr r�cannot_convertr+rr,r-r�
setdefaultr	rrr�parent�endswithr)rr!r"r'r#r(�new_namer�modulesZmod_dictrZas_nameZmember_nameZ	new_nodesZindentation�firstr.rZeltsr$Zelt�newZnodesZnew_noderrr�transform_member]sh	



	+



zFixUrllib.transform_membercCs�|jd�}|jd�}d}t|t�r@|d}nx6t|jD]'}|j|dkrN|d}PqNqNW|r�|jt|d|j��n|j|d�dS)z.Transform for calls to module members in code.�bare_with_attrr(Nrrrz!This is an invalid module element)	rr/r0rrr rrr1)rr!r"Z
module_dotr(r5rrrr�
transform_dot�s

zFixUrllib.transform_dotcCs�|jd�r"|j||�n�|jd�rD|j||�nf|jd�rf|j||�nD|jd�r�|j|d�n"|jd�r�|j|d�ndS)Nrr'r:Zmodule_starzCannot handle star imports.Z	module_asz#This module is now multiple modules)rr&r9r;r1)rr!r"rrr�	transform�szFixUrllib.transformN)�__name__�
__module__�__qualname__rr&r9r;r<rrrrrHs
LrN)�__doc__Zlib2to3.fixes.fix_importsrrZlib2to3rZlib2to3.fixer_utilrrrrr	r
rrrrrrrrr�<module>sD4