Your IP : 18.227.209.89
U
e5d� � @ s� d dl mZmZ d dlmZmZmZmZmZm Z m
Z
ddddddd d
dgfdd
ddddddddddddddgfddgfgddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4gfdd5d6gfgd7�Zed8 �ed9 d: � d;d<� Z
G d=d>� d>e�Zd?S )@� )�
alternates�
FixImports)�Name�Comma�
FromImport�Newline�find_indentation�Node�symszurllib.requestZ URLopenerZFancyURLopenerZurlretrieveZ
_urlopenerZurlopenZ
urlcleanupZpathname2urlZurl2pathnamezurllib.parseZquoteZ
quote_plusZunquoteZunquote_plusZ urlencodeZ splitattrZ splithostZ
splitnportZsplitpasswdZ splitportZ
splitqueryZsplittagZ splittypeZ splituserZ
splitvaluezurllib.errorZContentTooShortErrorZinstall_openerZbuild_openerZRequestZOpenerDirectorZBaseHandlerZHTTPDefaultErrorHandlerZHTTPRedirectHandlerZHTTPCookieProcessorZProxyHandlerZHTTPPasswordMgrZHTTPPasswordMgrWithDefaultRealmZAbstractBasicAuthHandlerZHTTPBasicAuthHandlerZProxyBasicAuthHandlerZAbstractDigestAuthHandlerZHTTPDigestAuthHandlerZProxyDigestAuthHandlerZHTTPHandlerZHTTPSHandlerZFileHandlerZ
FTPHandlerZCacheFTPHandlerZUnknownHandlerZURLErrorZ HTTPError)�urllib�urllib2r r � c c sv t � } t�� D ]b\}}|D ]T}|\}}t|�}d||f V d|||f V d| V d| V d||f V qqd S )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 �0/usr/lib64/python3.8/lib2to3/fixes/fix_urllib.py�
build_pattern0 s( �����r c @ s4 e Zd Zdd� Zdd� Zdd� Zdd� Zd d
� ZdS )� FixUrllibc C s d� t� �S )N�|)�joinr )�selfr r r r I s zFixUrllib.build_patternc C sv |� d�}|j}g }t|j d d� D ] }|�t|d |d�t� g� q&|�tt|j d d |d�� |�|� d S )N�module���r ��prefix) �getr r �value�extendr r �append�replace)r �node�resultsZ
import_mod�pref�names�namer r r �transform_importL s
zFixUrllib.transform_importc C s& |� d�}|j}|� d�}|r�t|t�r0|d }d }t|j D ]}|j|d kr>|d } q^q>|rv|�t||d�� n| �|d� �n�g }i } |d }
|
D ]�}|j t
jkr�|jd j}|jd j}n
|j}d }|d kr�t|j D ]B}||d kr�|d | k�r|�
|d � | �|d g ��
|� q�q�g }
t|�}d
}dd� }|D ]�}| | }g }|d d
� D ]"}|�|||�� |�
t� � �q^|�||d
|�� t||�}|�r�|jj�|��r�||_|
�
|� d}�qB|
�rg }|
d d
� D ]}|�|t� g� �q�|�
|
d
� |�|� n| �|d� d S )N�
mod_member�memberr r
r �!This is an invalid module elementr � �,Tc S sX | j tjkrHt| jd j|d�| jd �� | jd �� g}ttj|�gS t| j|d�gS )Nr r r
r, )�typer
�import_as_namer �childrenr Zcloner )r'