3
+��h� � # @ s� d Z ddlmZ ddlmZmZmZmZ ddlm Z
ddlmZ ddl
mZmZ ddlmZ dd d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*�"Zd+Zd,Zd-Zd.Zd/Zd0Zd1Zd2Zd3Zd4Zd5d6� ZG d7d8� d8ej�Zd9S ):z8
Fixer for standard library imports renamed in Python 3
� )�
fixer_base)�Name�is_probably_builtin�Newline�does_tree_import)�python_symbols)�token)�Node�Leaf)�touch_import_top�repr�_winreg�ConfigParser�copy_regz"multiprocessing.queues.SimpleQueue�Queue�SocketServer�
markupbaseztest.test_support�dbhash�dbm�dumbdbm�gdbm�
HTMLParser�htmlentitydefs�httplib�Cookie� cookielib�DialogZFixTk�ScrolledText�Tix�Tkconstants�Tkdnd�Tkinter�tkColorChooser�tkCommonDialog�tkFont�ttk�tkMessageBoxZturtle�robotparser� xmlrpclib�__builtin__)"�reprlib�winreg�configparser�copyregzmultiprocessing.SimpleQueue�queue�socketserver�_markupbaseztest.supportzdbm.bsdzdbm.ndbmzdbm.dumbzdbm.gnuzhtml.parserz
html.entitieszhttp.clientzhttp.cookieszhttp.cookiejarztkinter.dialogztkinter._fixztkinter.scrolledtextztkinter.tixztkinter.constantsztkinter.dndztkinter.__init__ztkinter.colorchooserztkinter.commondialogztkinter.fontztkinter.ttkztkinter.messageboxztkinter.turtlezurllib.robotparserz
xmlrpc.client�builtinsz name='%s'z attr='%s'z$dotted_name=dotted_name< %s '.' %s >z%sz"power< %s trailer< '.' %s > any* >zpower< %s any* >z:from_import=import_from< 'from' %s 'import' imported=any >z�from_import_submod=import_from< 'from' %s 'import' (%s | import_as_name< %s 'as' renamed=any > | import_as_names< any* (%s | import_as_name< %s 'as' renamed=any >) any* > ) >zrname_import=import_name< 'import' %s > | name_import=import_name< 'import' dotted_as_name< %s 'as' renamed=any > >zAname_import=import_name< 'import' dotted_as_names< names=any* > >c
C s� d| kr�| j dd�\} }t| }t| }t||f }t| }t|||||f }t||f }t||f }t| } dj ||||| f�S t| }t||f }t| }t
| }dj |||f�S dS )z�
Accepts a string and returns a pattern of possible patterns involving that name
Called by simple_mapping_to_pattern for each name in the mapping it receives.
�.� z |
N)�split�simple_name_match�
subname_match�dotted_name_match�from_import_match�from_import_submod_match�name_import_match�power_twoname_match�power_subname_match�join�power_onename_match)
�name�attrZsimple_nameZsimple_attrZdotted_nameZi_fromZ
i_from_submodZi_nameZu_nameZ u_subname� rA �F/root/tmp/pip-build-yeh9mt8d/future/libpasteurize/fixes/fix_imports.py�all_patternsP s rC c @ s6 e Zd Zdjdd� eD ��Zdjeef�Zdd� ZdS )�
FixImportsz |
c C s g | ]}t |��qS rA )rC )�.0r? rA rA rB �
<listcomp>m s zFixImports.<listcomp>c C s t dd|� d S )N�futureZstandard_library)r )�self�node�resultsrA rA rB � transformp s zFixImports.transformN)�__name__�
__module__�__qualname__r= �MAPPINGZPATTERN�multiple_name_import_matchrK rA rA rA rB rD k s rD N) �__doc__Zlib2to3r Zlib2to3.fixer_utilr r r r Zlib2to3.pygramr ZsymsZ
lib2to3.pgen2r Zlib2to3.pytreer r
Zlibfuturize.fixer_utilr rO r5 r6 r7 r> |