U
    h                  #   @   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tkMessageBox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 >zfrom_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|  dd\} }t|  }t| }t||f }t| }t|||||f }t||f }t||f }t| }	d	|||||	fS t|  }t||f }t| }t
| }d	|||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.
    .    | 
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 rD   Q/var/www/html/venv/lib/python3.8/site-packages/libpasteurize/fixes/fix_imports.pyall_patternsP   s     rF   c                   @   s6   e Zd Zddd eD ZdeefZdd ZdS )
FixImportsr6   c                 C   s   g | ]}t |qS rD   )rF   ).0rB   rD   rD   rE   
<listcomp>m   s     zFixImports.<listcomp>c                 C   s   t dd| d S )NfutureZstandard_libraryr   )selfnoderesultsrD   rD   rE   	transformp   s    zFixImports.transformN)__name__
__module____qualname__r@   MAPPINGZPATTERNmultiple_name_import_matchrN   rD   rD   rD   rE   rG   k   s   rG   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   rR   r8   r9   r:   rA   r>   r?   r;   r<   r=   rS   rF   ZBaseFixrG   rD   rD   rD   rE   <module>   sj   -