3
‡Œði¢  ã            #   @   sì   d Z ddlmZ ddlmZmZmZmZ ddlm	Z
 ddlmZ ddlmZmZ ddlmZ dd	d
dddddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*œ"Zd+Zd,Zd-Zd.Zd/Zd0Zd1Zd2Zd3Zd4Zd5d6„ ZG d7d8„ d8ejƒZd9S ):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Ú
markupbaseztest.test_supportÚdbhashÚdbmÚdumbdbmÚgdbmÚ
HTMLParserÚhtmlentitydefsÚhttplibÚCookieÚ	cookielibÚDialogZFixTkÚScrolledTextÚTixÚTkconstantsÚTkdndÚTkinterÚtkColorChooserÚtkCommonDialogÚtkFontÚttkÚtkMessageBoxZturtleÚrobotparserÚ	xmlrpclibÚ__builtin__)"ÚreprlibÚwinregÚconfigparserÚcopyregzmultiprocessing.SimpleQueueÚqueueÚsocketserverÚ_markupbaseztest.supportzdbm.bsdzdbm.ndbmzdbm.dumbzdbm.gnuzhtml.parserzhtml.entitieszhttp.clientzhttp.cookieszhttp.cookiejarztkinter.dialogztkinter._fixztkinter.scrolledtextztkinter.tixztkinter.constantsztkinter.dndztkinter.__init__ztkinter.colorchooserztkinter.commondialogztkinter.fontztkinter.ttkztkinter.messageboxztkinter.turtlezurllib.robotparserzxmlrpc.clientÚbuiltinsz	name='%s'z	attr='%s'z$dotted_name=dotted_name< %s '.' %s >z%sz"power< %s trailer< '.' %s > any* >zpower< %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| kr‚| j ddƒ\} }t|  }t| }t||f }t| }t|||||f }t||f }t||f }t| }	dj	|||||	fƒS t|  }t||f }t| }t
| }dj	|||fƒS dS )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ÚattrZsimple_nameZsimple_attrZdotted_nameZi_fromZi_from_submodZi_nameZu_nameZ	u_subname© rA   úA/tmp/pip-build-6m2fasei/future/libpasteurize/fixes/fix_imports.pyÚall_patternsP   s     rC   c               @   s6   e Zd Zdjdd„ eD ƒƒZdjeefƒZdd„ ZdS )Ú
FixImportsz | 
c             C   s   g | ]}t |ƒ‘qS rA   )rC   )Ú.0r?   rA   rA   rB   ú
<listcomp>m   s    zFixImports.<listcomp>c             C   s   t dd|ƒ d S )NÚfutureZstandard_library)r   )ÚselfÚnodeÚresultsrA   rA   rB   Ú	transformp   s    zFixImports.transformN)Ú__name__Ú
__module__Ú__qualname__r=   ÚMAPPINGZPATTERNÚmultiple_name_import_matchrK   rA   rA   rA   rB   rD   k   s   rD   N) Ú__doc__Zlib2to3r   Zlib2to3.fixer_utilr   r   r   r   Zlib2to3.pygramr   ZsymsZlib2to3.pgen2r   Zlib2to3.pytreer	   r
   Zlibfuturize.fixer_utilr   rO   r5   r6   r7   r>   r;   r<   r8   r9   r:   rP   rC   ZBaseFixrD   rA   rA   rA   rB   Ú<module>   sh   