a
�DOg4 � 1 @ s� d Z ddlmZ ddlmZmZ ddddddd d
dddd
d
ddddddddddddddddddd d!d"d"d#d$d%d&d'd(d(d(d)d*d*d+d,d-�0Zd.d/� Zefd0d1�ZG d2d3� d3ej �Z
d4S )5z/Fix incompatible imports and module references.� )�
fixer_base)�Name�
attr_chain�io�pickle�builtins�copyreg�queue�socketserver�configparser�reprlibztkinter.filedialogztkinter.simpledialogztkinter.colorchooserztkinter.commondialogztkinter.dialogztkinter.dndztkinter.fontztkinter.messageboxztkinter.scrolledtextztkinter.constantsztkinter.tixztkinter.ttk�tkinter�_markupbase�winreg�_thread�
_dummy_threadzdbm.bsdzdbm.dumbzdbm.ndbmzdbm.gnuz
xmlrpc.clientz
xmlrpc.serverzhttp.clientz
html.entitieszhtml.parserzhttp.cookieszhttp.cookiejarzhttp.server�
subprocess�collectionszurllib.parsezurllib.robotparser)0�StringIO� cStringIO�cPickle�__builtin__�copy_reg�Queue�SocketServer�ConfigParser�repr�
FileDialog�tkFileDialog�SimpleDialog�tkSimpleDialog�tkColorChooser�tkCommonDialog�Dialog�Tkdnd�tkFont�tkMessageBox�ScrolledText�Tkconstants�Tix�ttk�Tkinter�
markupbase�_winreg�thread�dummy_thread�dbhash�dumbdbm�dbm�gdbm� xmlrpclib�DocXMLRPCServer�SimpleXMLRPCServer�httplib�htmlentitydefs�
HTMLParser�Cookie� cookielib�BaseHTTPServer�SimpleHTTPServer�
CGIHTTPServer�commands�
UserString�UserList�urlparse�robotparserc C s dd� tt| �� d S )N�(�|�))�join�mapr )�members� rJ �1/usr/lib64/python3.9/lib2to3/fixes/fix_imports.py�
alternates= s rL c c sT d� dd� | D ��}t| �� �}d||f V d| V d||f V d| V d S )Nz | c S s g | ]}d | �qS )zmodule_name='%s'rJ )�.0�keyrJ rJ rK �
<listcomp>B � z!build_pattern.<locals>.<listcomp>zyname_import=import_name< 'import' ((%s) |
multiple_imports=dotted_as_names< any* (%s) any* >) >
z�import_from< 'from' (%s) 'import' ['(']
( any | import_as_name< any 'as' any > |
import_as_names< any* >) [')'] >
z�import_name< 'import' (dotted_as_name< (%s) 'as' any > |
multiple_imports=dotted_as_names<
any* dotted_as_name< (%s) 'as' any > any* >) >
z3power< bare_with_attr=(%s) trailer<'.' any > any* >)rG rL �keys)�mappingZmod_listZ
bare_namesrJ rJ rK �
build_patternA s ���rS c sT e Zd ZdZdZeZdZdd� Z� fdd�Z � fdd�Z
� fd d
�Zdd� Z� Z
S )
�
FixImportsT� c C s d� t| j��S )NrE )rG rS rR ��selfrJ rJ rK rS ` s zFixImports.build_patternc s | � � | _tt| ��� d S �N)rS ZPATTERN�superrT �compile_patternrV �� __class__rJ rK rZ c s
zFixImports.compile_patternc sH t t| �j� � |�}|rDd|vr@t� fdd�t|d�D ��r@dS |S dS )N�bare_with_attrc 3 s | ]}� |�V qd S rX rJ )rM �obj��matchrJ rK � <genexpr>q rP z#FixImports.match.<locals>.<genexpr>�parentF)rY rT r` �anyr )rW �node�resultsr[ r_ rK r` j s �zFixImports.matchc s t t| ��||� i | _d S rX )rY rT �
start_tree�replace)rW Ztree�filenamer[ rJ rK rf v s zFixImports.start_treec C s� |� d�}|rh|j}| j| }|�t||jd�� d|v rD|| j|<