Your IP : 3.137.175.166


Current Path : /opt/alt/python310/lib64/python3.10/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/lib2to3/fixes/__pycache__/fix_urllib.cpython-310.opt-2.pyc

o

6��f� �@s�	ddlmZmZddlmZmZmZmZmZm	Z	m
Z
dgd�fdgd�fddgfgdgd	�fdd
dgfgd�Zed
�edd�dd�Z
Gdd�de�ZdS)�)�
alternates�
FixImports)�Name�Comma�
FromImport�Newline�find_indentation�Node�symszurllib.request)	Z	URLopenerZFancyURLopenerZurlretrieveZ
_urlopener�urlopenZ
urlcleanupZpathname2urlZurl2pathnameZ
getproxieszurllib.parse)ZquoteZ
quote_plusZunquoteZunquote_plusZ	urlencodeZ	splitattrZ	splithostZ
splitnportZsplitpasswdZ	splitportZ
splitqueryZsplittagZ	splittypeZ	splituserZ
splitvaluezurllib.errorZContentTooShortError)rZinstall_openerZbuild_openerZRequestZOpenerDirectorZBaseHandlerZHTTPDefaultErrorHandlerZHTTPRedirectHandlerZHTTPCookieProcessorZProxyHandlerZHTTPPasswordMgrZHTTPPasswordMgrWithDefaultRealmZAbstractBasicAuthHandlerZHTTPBasicAuthHandlerZProxyBasicAuthHandlerZAbstractDigestAuthHandlerZHTTPDigestAuthHandlerZProxyDigestAuthHandlerZHTTPHandlerZHTTPSHandlerZFileHandlerZ
FTPHandlerZCacheFTPHandlerZUnknownHandlerZURLErrorZ	HTTPError)�urllib�urllib2r
r�ccsx�t�}t��D]1\}}|D]*}|\}}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�?/opt/alt/python310/lib64/python3.10/lib2to3/fixes/fix_urllib.py�
build_pattern0s.��������rc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�	FixUrllibcCsd�t��S)N�|)�joinr)�selfrrrrIszFixUrllib.build_patterncCsx	|�d�}|j}g}t|jdd�D]}|�t|d|d�t�g�q|�tt|jdd|d��|�|�dS)N�module���r��prefix)	�getrr�value�extendrr�append�replace)r�node�resultsZ
import_mod�pref�names�namerrr�transform_importLs
 zFixUrllib.transform_importcCs 	|�d�}|j}|�d�}|rEt|t�r|d}d}t|jD]}|j|dvr/|d}nq |r=|�t||d��dS|�|d�dSg}i}	|d}
|
D]D}|j	t
jkrd|jdj}|jdj}n|j}d}|d	kr�t|jD] }||dvr�|d|	vr�|�
|d�|	�|dg��
|�qrqOg}
t|�}d
}dd�}|D]A}|	|}g}|dd
�D]}|�|||��|�
t��q�|�||d
|��t||�}|r�|jj�|�r�||_|
�
|�d}q�|
�rg}|
dd
�D]
}|�|t�g�q�|�
|
d
�|�|�dS|�|d�dS)N�
mod_member�memberrrr�!This is an invalid module elementr��,TcSsX|jtjkr$t|jdj|d�|jd��|jd��g}ttj|�gSt|j|d�gS)Nrrrr-)�typer
�import_as_namer�childrenr Zcloner	)r(rZkidsrrr�handle_name�s�z/FixUrllib.transform_member.<locals>.handle_namerFzAll module elements are invalid)rr�
isinstance�listrr r#r�cannot_convertr/r
r0r1r"�
setdefaultrr!rr�parent�endswithr)rr$r%r*r&r+�new_namer�modulesZmod_dictrZas_name�member_nameZ	new_nodesZindentation�firstr2r�eltsr'�elt�newZnodesZnew_noderrr�transform_member\sn


��

zFixUrllib.transform_membercCs�	|�d�}|�d�}d}t|t�r|d}t|jD]}|j|dvr*|d}nq|r9|�t||jd��dS|�|d�dS)N�bare_with_attrr+rrrr,)	rr3r4rr r#rrr5)rr$r%Z
module_dotr+r9rrrr�
transform_dot�s 


��zFixUrllib.transform_dotcCs�|�d�r
|�||�dS|�d�r|�||�dS|�d�r'|�||�dS|�d�r4|�|d�dS|�d�rA|�|d�dSdS)Nrr*rAZmodule_starzCannot handle star imports.Z	module_asz#This module is now multiple modules)rr)r@rBr5)rr$r%rrr�	transform�s




�zFixUrllib.transformN)�__name__�
__module__�__qualname__rr)r@rBrCrrrrrGsLrN)Zlib2to3.fixes.fix_importsrrZlib2to3.fixer_utilrrrrrr	r
rr"rrrrrr�<module>s0$����
����!

?>