AlkantarClanX12

Your IP : 3.15.12.95


Current Path : /proc/self/root/usr/lib64/python3.8/lib2to3/fixes/__pycache__/
Upload File :
Current File : //proc/self/root/usr/lib64/python3.8/lib2to3/fixes/__pycache__/fix_urllib.cpython-38.pyc

U

e5d� �@s�dZddlmZmZddlmZmZmZmZm	Z	m
Z
mZdddddd	d
ddgfd
dddddddddddddddgfddgfgdd	dd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5gfdd6d7gfgd8�Zed9�
ed: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)�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�ccsvt�}t��D]b\}}|D]T}|\}}t|�}d||fVd|||fVd|Vd|Vd||fVqqdS)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_pattern0s(�����rc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�	FixUrllibcCsd�t��S)N�|)�joinr)�selfrrrrIszFixUrllib.build_patterncCsv|�d�}|j}g}t|jdd�D] }|�t|d|d�t�g�q&|�tt|jdd|d��|�|�dS)z�Transform for the basic import case. Replaces the old
           import name with a comma separated list of its
           replacements.
        �moduleN���r��prefix)	�getrr�value�extendrr�append�replace)r�node�resultsZ
import_mod�pref�names�namerrr�transform_importLs
 zFixUrllib.transform_importcCs&|�d�}|j}|�d�}|r�t|t�r0|d}d}t|jD]}|j|dkr>|d}q^q>|rv|�t||d��n|�|d��n�g}i}	|d}
|
D]�}|j	t
jkr�|jd	j}|jdj}n
|j}d}|d
kr�t|jD]B}||dkr�|d|	k�r|�
|d�|	�|dg��
|�q�q�g}
t|�}d}dd
�}|D]�}|	|}g}|dd�D]"}|�|||��|�
t���q^|�||d|��t||�}|�r�|jj�|��r�||_|
�
|�d}�qB|
�rg}|
dd�D]}|�|t�g��q�|�
|
d�|�|�n|�|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
r�!This is an invalid module elementr��,TcSsX|jtjkrHt|jdj|d�|jd��|jd��g}ttj|�gSt|j|d�gS)Nrrr
r,)�typer
�import_as_namer�childrenrZcloner	)r'rZkidsrrr�handle_name�s�z/FixUrllib.transform_member.<locals>.handle_namerFzAll module elements are invalid)rr�
isinstance�listrrr"r�cannot_convertr.r
r/r0r!�
setdefaultrr rr�parent�endswithr)rr#r$r)r%r*�new_namer�modulesZmod_dictrZas_name�member_nameZ	new_nodesZindentation�firstr1rZeltsr&Zelt�newZnodesZnew_noderrr�transform_member\sh




zFixUrllib.transform_membercCs~|�d�}|�d�}d}t|t�r*|d}t|jD]}|j|dkr4|d}qTq4|rn|�t||jd��n|�|d�dS)z.Transform for calls to module members in code.�bare_with_attrr*Nrr
rr+)	rr2r3rrr"rrr4)rr#r$Z
module_dotr*r8rrrr�
transform_dot�s


�
zFixUrllib.transform_dotcCsz|�d�r|�||�n^|�d�r0|�||�nF|�d�rH|�||�n.|�d�r`|�|d�n|�d�rv|�|d�dS)Nrr)r>Zmodule_starzCannot handle star imports.Z	module_asz#This module is now multiple modules)rr(r=r?r4)rr#r$rrr�	transform�s




zFixUrllib.transformN)�__name__�
__module__�__qualname__rr(r=r?r@rrrrrGs
LrN)�__doc__Zlib2to3.fixes.fix_importsrrZlib2to3.fixer_utilrrrrrr	r
rr!rrrrrr�<module>s~$������
�����!