Hacked By AnonymousFox

Current Path : /opt/alt/python35/lib64/python3.5/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/lib2to3/fixes/__pycache__/fix_urllib.cpython-35.pyc



��Yf� �@stdZddlmZmZddlmZddlmZmZm	Z	m
Z
mZmZm
Z
ddddd	d
ddd
dgfddddddddddddddddgfdd gfgd!ddd"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8gfdd9d:gfgiZed!jedd;�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�symsZurllibzurllib.requestZ	URLopenerZFancyURLopenerZurlretrieveZ
_urlopenerZurlopenZ
urlcleanupZpathname2urlZurl2pathnamezurllib.parseZquoteZ
quote_plusZunquoteZunquote_plusZ	urlencodeZ	splitattrZ	splithostZ
splitnportZsplitpasswdZ	splitportZ
splitqueryZsplittagZ	splittypeZ	splituserZ
splitvaluezurllib.errorZContentTooShortErrorZurllib2Zinstall_openerZbuild_openerZRequestZOpenerDirectorZBaseHandlerZHTTPDefaultErrorHandlerZHTTPRedirectHandlerZHTTPCookieProcessorZProxyHandlerZHTTPPasswordMgrZHTTPPasswordMgrWithDefaultRealmZAbstractBasicAuthHandlerZHTTPBasicAuthHandlerZProxyBasicAuthHandlerZAbstractDigestAuthHandlerZHTTPDigestAuthHandlerZProxyDigestAuthHandlerZHTTPHandlerZHTTPSHandlerZFileHandlerZ
FTPHandlerZCacheFTPHandlerZUnknownHandlerZURLErrorZ	HTTPError�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/python35/lib64/python3.5/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�rF|d}d}x3t|jD]$}|j|dkrZ|d}PqZW|r�|jt|d|��q�|j|d�n2g}i}	|d}
x�|
D]�}|j	t
jkr|jd	j}|jdj}n|j}d}|d
kr�xct|jD]T}||dkr8|d|	kro|j
|d�|	j|dg�j
|�q8Wq�Wg}
t|�}d}dd
�}x�|D]�}|	|}g}x>|dd�D],}|j|||��|j
t��q�W|j||d|��t||�}|s[|jjj|�rd||_|
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}x3t|jD]$}|j|dkrK|d}PqKW|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||�nc|jd�rf|j||�nA|jd�r�|j|d�n|jd�r�|j|d�dS)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>sF4						

Hacked By AnonymousFox1.0, Coded By AnonymousFox