Your IP : 13.58.191.60


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.opt-2.pyc



���]� �@snddlmZmZddlmZddlmZmZmZm	Z	m
Z
mZmZdddddd	d
ddd
gfddddddddddddddddgfddgfgd dd
d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7gfdd8d9gfgiZ
e
d je
dd:�d;d<�ZGd=d>�d>e�Zd?S)@�)�
alternates�
FixImports)�
fixer_base)�Name�Comma�
FromImport�Newline�find_indentation�Node�syms�urllibzurllib.requestZ	URLopenerZFancyURLopener�urlretrieveZ
_urlopener�urlopen�
urlcleanup�pathname2url�url2pathnamezurllib.parse�quote�
quote_plus�unquote�unquote_plus�	urlencodeZ	splitattrZ	splithostZ
splitnportZsplitpasswdZ	splitportZ
splitqueryZsplittagZ	splittypeZ	splituserZ
splitvaluezurllib.error�ContentTooShortError�urllib2Zinstall_openerZbuild_openerZRequestZOpenerDirectorZBaseHandlerZHTTPDefaultErrorHandlerZHTTPRedirectHandlerZHTTPCookieProcessorZProxyHandlerZHTTPPasswordMgrZHTTPPasswordMgrWithDefaultRealmZAbstractBasicAuthHandlerZHTTPBasicAuthHandlerZProxyBasicAuthHandlerZAbstractDigestAuthHandlerZHTTPDigestAuthHandlerZProxyDigestAuthHandlerZHTTPHandlerZHTTPSHandler�FileHandlerZ
FTPHandlerZCacheFTPHandlerZUnknownHandler�URLError�	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/fix_urllib.py�
build_pattern1s	
		r$c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�	FixUrllibcCsdjt��S)N�|)�joinr$)�selfr"r"r#r$JszFixUrllib.build_patterncCs�|jd�}|j}g}xEt|jdd�D],}|jt|dd|�t�g�q6W|jtt|jddd|��|j|�dS)N�modulerr�prefix���r+)	�getr*r�value�extendrr�append�replace)r(�node�resultsZ
import_mod�pref�names�namer"r"r#�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dj}|jdj}n|j}d}|d	kr�xct|jD]T}||dkr8|d|	kro|j
|d�|	j|dg�j
|�q8Wq�Wg}
t|�}d
}dd�}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)N�
mod_member�memberrrr*z!This is an invalid module elementr!��,TcSsz|jtjkrdt|jdjd|�|jdj�|jdj�g}ttj|�gSt|jd|�gS)Nrr*rr9)�typer�import_as_namer�childrenr-Zcloner
)r5r*Zkidsr"r"r#�handle_name�sz/FixUrllib.transform_member.<locals>.handle_nameFzAll module elements are invalidr+r+r+r+)r,r*�
isinstance�listrr-r0r�cannot_convertr;rr<r=r/�
setdefaultr	r.rr�parent�endswithr)r(r1r2r7r3r8�new_namer �modulesZmod_dictr!Zas_name�member_nameZ	new_nodesZindentation�firstr>r)Zeltsr4Zelt�newZnodesZnew_noder"r"r#�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)N�bare_with_attrr8rrr*z!This is an invalid module element)	r,r?r@rr-r0rr*rA)r(r1r2Z
module_dotr8rEr r"r"r#�
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)Nr)r7rKZmodule_starzCannot handle star imports.Z	module_asz#This module is now multiple modules)r,r6rJrLrA)r(r1r2r"r"r#�	transform�szFixUrllib.transformN)�__name__�
__module__�__qualname__r$r6rJrLrMr"r"r"r#r%Hs
Lr%N)Zlib2to3.fixes.fix_importsrrZlib2to3rZlib2to3.fixer_utilrrrrr	r
rrr/r$r%r"r"r"r#�<module>sD4						

?>