Your IP : 3.139.93.242


Current Path : /opt/alt/python36/lib64/python3.6/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/lib2to3/fixes/__pycache__/fix_urllib.cpython-36.opt-2.pyc

3

��2a� �@s�ddlmZmZddlmZmZmZmZmZm	Z	m
Z
ddddddd	d
dgfdd
ddddddddddddddgfddgfgddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4gfdd5d6gfgd7�Zed8jed9d:�d;d<�Z
Gd=d>�d>e�Zd?S)@�)�
alternates�
FixImports)�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.errorZContentTooShortErrorZinstall_openerZbuild_openerZRequestZOpenerDirectorZBaseHandlerZHTTPDefaultErrorHandlerZHTTPRedirectHandlerZHTTPCookieProcessorZProxyHandlerZHTTPPasswordMgrZHTTPPasswordMgrWithDefaultRealmZAbstractBasicAuthHandlerZHTTPBasicAuthHandlerZProxyBasicAuthHandlerZAbstractDigestAuthHandlerZHTTPDigestAuthHandlerZProxyDigestAuthHandlerZHTTPHandlerZHTTPSHandlerZFileHandlerZ
FTPHandlerZCacheFTPHandlerZUnknownHandlerZURLErrorZ	HTTPError)�urllib�urllib2rr�ccs~t�}xrtj�D]f\}}x\|D]T}|\}}t|�}d||fVd|||fVd|Vd|Vd||fVqWqWdS)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/python36/lib64/python3.6/fix_urllib.py�
build_pattern0s


rc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�	FixUrllibcCsdjt��S)N�|)�joinr)�selfrrrrIszFixUrllib.build_patterncCsz|jd�}|j}g}x6t|jdd�D] }|jt|d|d�t�g�q(W|jtt|jdd|d��|j|�dS)N�moduler
r)�prefix���r)	�getrr�value�extendrr�append�replace)r�node�resultsZ
import_mod�pref�names�namerrr�transform_importLs
  zFixUrllib.transform_importcCs>|jd�}|j}|jd�}|r�t|t�r0|d}d}x*t|jD]}|j|dkr@|d}Pq@W|rx|jt||d��n|j|d��n�g}i}	|d}
x�|
D]�}|j	t
jkr�|jdj}|jdj}n
|j}d}|d	kr�xPt|jD]B}||dkr�|d|	k�r|j
|d�|	j|dg�j
|�q�Wq�Wg}
t|�}d
}dd�}x�|D]�}|	|}g}x2|dd�D]"}|j|||��|j
t���qlW|j||d|��t||�}|�s�|jjj|��r�||_|
j
|�d
}�qNW|
�r.g}x&|
dd�D]}|j|t�g��q�W|j
|
d�|j|�n|j|d�dS)N�
mod_member�memberrr
)rz!This is an invalid module elementr��,TcSsX|jtjkrHt|jdj|d�|jdj�|jdj�g}ttj|�gSt|j|d�gS)Nr)rr
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,r
r-r.r �
setdefaultrrrr�parent�endswithr)rr"r#r(r$r)�new_namer�modulesZmod_dictrZas_name�member_nameZ	new_nodesZindentation�firstr/rZeltsr%Zelt�newZnodesZnew_noderrr�transform_member\sh







zFixUrllib.transform_membercCs�|jd�}|jd�}d}t|t�r*|d}x*t|jD]}|j|dkr6|d}Pq6W|rp|jt||jd��n|j|d�dS)N�bare_with_attrr)rr
)rz!This is an invalid module element)	rr0r1rrr!rrr2)rr"r#Z
module_dotr)r6rrrr�
transform_dot�s


zFixUrllib.transform_dotcCsz|jd�r|j||�n^|jd�r0|j||�nF|jd�rH|j||�n.|jd�r`|j|d�n|jd�rv|j|d�dS)Nrr(r<Zmodule_starzCannot handle star imports.Z	module_asz#This module is now multiple modules)rr'r;r=r2)rr"r#rrr�	transform�s




zFixUrllib.transformN)�__name__�
__module__�__qualname__rr'r;r=r>rrrrrGs
LrN)Zlib2to3.fixes.fix_importsrrZlib2to3.fixer_utilrrrrrr	r
rr rrrrrr�<module>s>$


?>