Current File : //snap/core22/current/usr/lib/python3.10/lib2to3/fixes/__pycache__/fix_imports.cpython-310.pyc |
o
��bc4 � @ s@ d Z ddlmZ ddlmZmZ i dd�dd�dd�d d
�dd�d
d�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd �d!d"�i d#d$�d%d&�d'd(�d)d*�d+d,�d-d.�d/d0�d1d2�d3d4�d5d6�d7d8�d9d:�d;d<�d=d>�d?d@�dAdB�dCdD��dDdEdFdGdHdIdJdJdJdKdLdLdMdNdO��ZdPdQ� ZefdRdS�ZG dTdU� dUej �Z
dVS )Wz/Fix incompatible imports and module references.� )�
fixer_base)�Name�
attr_chain�StringIO�io� cStringIO�cPickle�pickle�__builtin__�builtins�copy_reg�copyreg�Queue�queue�SocketServer�socketserver�ConfigParser�configparser�repr�reprlib�
FileDialogztkinter.filedialog�tkFileDialog�SimpleDialogztkinter.simpledialog�tkSimpleDialog�tkColorChooserztkinter.colorchooser�tkCommonDialogztkinter.commondialog�Dialogztkinter.dialog�Tkdndztkinter.dnd�tkFontztkinter.font�tkMessageBoxztkinter.messagebox�ScrolledTextztkinter.scrolledtext�Tkconstantsztkinter.constants�Tixztkinter.tix�ttkztkinter.ttk�Tkinter�tkinter�
markupbase�_markupbase�_winreg�winreg�thread�_thread�dummy_thread�
_dummy_thread�dbhashzdbm.bsd�dumbdbmzdbm.dumb�dbmzdbm.ndbm�gdbmzdbm.gnu� xmlrpclibz
xmlrpc.client�DocXMLRPCServerz
xmlrpc.serverzhttp.clientz
html.entitieszhtml.parserzhttp.cookieszhttp.cookiejarzhttp.server�
subprocess�collectionszurllib.parsezurllib.robotparser)�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 �0/usr/lib/python3.10/lib2to3/fixes/fix_imports.py�
alternates= s rL c c sV � 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 s 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)�mapping�mod_list�
bare_namesrJ rJ rK �
build_patternA s ����rT 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 rT rQ ��selfrJ rJ rK rT ` s zFixImports.build_patternc s | � � | _tt| ��� d S �N)rT �PATTERN�superrU �compile_patternrW �� __class__rJ rK r\ c s
zFixImports.compile_patternc sH t t| �j� � |�}|r"d|vr t� fdd�t|d�D ��r dS |S dS )N�bare_with_attrc 3 s � | ]}� |�V qd S rY rJ )rM �obj��matchrJ rK � <genexpr>q s � z#FixImports.match.<locals>.<genexpr>�parentF)r[ rU rb �anyr )rX �node�resultsr] ra rK rb j s �zFixImports.matchc s t t| ��||� i | _d S rY )r[ rU �
start_tree�replace)rX �tree�filenamer] rJ rK rh v s
zFixImports.start_treec C s� |� d�}|r9|j}| j| }|�t||jd�� d|v r"|| j|<