
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
U
    ¡ê,a¡   ã                   @   sö   d Z ddlmZmZ ddlmZmZmZmZm	Z	m
Z
mZ dddddd	d
ddgfddddddddddddddddgfddgfgdd	dd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5gfdd6d7gfgd8œZed9  ed: d; ¡ d<d=„ ZG d>d?„ d?eƒZd@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Úsymszurllib.requestZ	URLopenerZFancyURLopenerZurlretrieveZ
_urlopenerZurlopenZ
urlcleanupZpathname2urlZurl2pathnamezurllib.parseZquoteZ
quote_plusZunquoteZunquote_plusZ	urlencodeZ	splitattrZ	splithostZ
splitnportZsplitpasswdZ	splitportZ
splitqueryZsplittagZ	splittypeZ	splituserZ
splitvaluezurllib.errorZContentTooShortErrorZinstall_openerZbuild_openerZRequestZOpenerDirectorZBaseHandlerZHTTPDefaultErrorHandlerZHTTPRedirectHandlerZHTTPCookieProcessorZProxyHandlerZHTTPPasswordMgrZHTTPPasswordMgrWithDefaultRealmZAbstractBasicAuthHandlerZHTTPBasicAuthHandlerZProxyBasicAuthHandlerZAbstractDigestAuthHandlerZHTTPDigestAuthHandlerZProxyDigestAuthHandlerZHTTPHandlerZHTTPSHandlerZFileHandlerZ
FTPHandlerZCacheFTPHandlerZUnknownHandlerZURLErrorZ	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  qqd 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   )ZbareZ
old_moduleZchangesÚchangeZ
new_moduleÚmembers© r   ú=/opt/alt/python38/lib64/python3.8/lib2to3/fixes/fix_urllib.pyÚbuild_pattern0   s(    þýÿþÿr   c                   @   s4   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ ZdS )Ú	FixUrllibc                 C   s   d  tƒ ¡S )Nú|)Újoinr   )Úselfr   r   r   r   I   s    zFixUrllib.build_patternc                 C   sv   |  d¡}|j}g }t|j dd… D ] }| t|d |d�tƒ g¡ q&| tt|j d d |d�¡ | |¡ dS )z‘Transform for the basic import case. Replaces the old
           import name with a comma separated list of its
           replacements.
        ÚmoduleNéÿÿÿÿr   ©Úprefix)	Úgetr   r   ÚvalueÚextendr   r   ÚappendÚreplace)r   ÚnodeÚresultsZ
import_modÚprefÚnamesÚnamer   r   r   Útransform_importL   s    
 zFixUrllib.transform_importc                 C   s&  |  d¡}|j}|  d¡}|r†t|tƒr0|d }d}t|j D ]}|j|d kr>|d } q^q>|rv| t||d�¡ n|  |d¡ �nœg }i }	|d }
|
D ]Š}|j	t
jkrÄ|jd	 j}|jd j}n
|j}d}|d
kršt|j D ]B}||d krà|d |	k�r| |d ¡ |	 |d g ¡ |¡ qàqšg }t|ƒ}d}dd„ }|D ]Š}|	| }g }|dd… D ]"}| |||ƒ¡ | tƒ ¡ �q^| ||d |ƒ¡ t||ƒ}|�r¶|jj |¡�r¼||_| |¡ d}�qB|�rg }|dd… D ]}| |tƒ g¡ �qä| |d ¡ | |¡ n|  |d¡ dS )zšTransform for imports of specific module elements. Replaces
           the module to be imported from with the appropriate new
           module.
        Ú
mod_memberÚmemberr   Nr   r   ú!This is an invalid module elementr   é   ú,Tc                 S   sX   | j tjkrHt| jd j|d�| jd  ¡ | jd  ¡ g}ttj|ƒgS t| j|d�gS )Nr   r   r   r,   )Útyper
   Úimport_as_namer   Úchildrenr   Zcloner	   )r'   r   Zkidsr   r   r   Úhandle_nameŒ   s    þz/FixUrllib.transform_member.<locals>.handle_namer   FzAll module elements are invalid)r   r   Ú
isinstanceÚlistr   r   r"   r   Úcannot_convertr.   r
   r/   r0   r!   Ú
setdefaultr   r    r   r   ÚparentÚendswithr   )r   r#   r$   r)   r%   r*   Únew_namer   ÚmodulesZmod_dictr   Zas_nameÚmember_nameZ	new_nodesZindentationÚfirstr1   r   Zeltsr&   ZeltÚnewZnodesZnew_noder   r   r   Útransform_member\   sh    




zFixUrllib.transform_memberc                 C   s~   |  d¡}|  d¡}d}t|tƒr*|d }t|j D ]}|j|d kr4|d } qTq4|rn| t||jd�¡ n|  |d¡ dS )z.Transform for calls to module members in code.Úbare_with_attrr*   Nr   r   r   r+   )	r   r2   r3   r   r   r"   r   r   r4   )r   r#   r$   Z
module_dotr*   r8   r   r   r   r   Útransform_dot¨   s    


ÿ
zFixUrllib.transform_dotc                 C   sz   |  d¡r|  ||¡ n^|  d¡r0|  ||¡ nF|  d¡rH|  ||¡ n.|  d¡r`|  |d¡ n|  d¡rv|  |d¡ d S )Nr   r)   r>   Zmodule_starzCannot handle star imports.Z	module_asz#This module is now multiple modules)r   r(   r=   r?   r4   )r   r#   r$   r   r   r   Ú	transform¹   s    




zFixUrllib.transformN)Ú__name__Ú
__module__Ú__qualname__r   r(   r=   r?   r@   r   r   r   r   r   G   s
   Lr   N)Ú__doc__Zlib2to3.fixes.fix_importsr   r   Zlib2to3.fixer_utilr   r   r   r   r   r	   r
   r   r!   r   r   r   r   r   r   Ú<module>   s~   $   þÿ        ýÿÿö         ôÿÿñô!