o
    bc4                     @   s@  d Z ddlmZ ddlmZmZ i 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"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ZdPdQ ZefdRdSZG dTdU dUej	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
FileDialogztkinter.filedialogtkFileDialogSimpleDialogztkinter.simpledialogtkSimpleDialogtkColorChooserztkinter.colorchoosertkCommonDialogztkinter.commondialogDialogztkinter.dialogTkdndztkinter.dndtkFontztkinter.fonttkMessageBoxztkinter.messageboxScrolledTextztkinter.scrolledtextTkconstantsztkinter.constantsTixztkinter.tixttkztkinter.ttkTkintertkinter
markupbase_markupbase_winregwinregthread_threaddummy_thread_dummy_threaddbhashzdbm.bsddumbdbmzdbm.dumbdbmzdbm.ndbmgdbmzdbm.gnu	xmlrpclibzxmlrpc.clientDocXMLRPCServerzxmlrpc.serverzhttp.clientzhtml.entitieszhtml.parserzhttp.cookieszhttp.cookiejarzhttp.server
subprocesscollectionszurllib.parsezurllib.robotparser)SimpleXMLRPCServerhttplibhtmlentitydefs
HTMLParserCookie	cookielibBaseHTTPServerSimpleHTTPServerCGIHTTPServercommands
UserStringUserListurlparserobotparserc                 C   s   dd tt|  d S )N(|))joinmapr   )members rJ   0/usr/lib/python3.10/lib2to3/fixes/fix_imports.py
alternates=   s   rL   c                 c   sV    d dd | D }t|  }d||f V  d| V  d||f V  d| V  d S )Nz | c                 S   s   g | ]}d | qS )zmodule_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* >) >
          zimport_from< 'from' (%s) 'import' ['(']
              ( any | import_as_name< any 'as' any > |
                import_as_names< any* >)  [')'] >
          zimport_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 Zd ZdZdZeZdZdd Z fddZ	 fddZ
 fd	d
Zdd Z  ZS )
FixImportsT   c                 C   s   d t| jS )NrE   )rG   rT   rQ   selfrJ   rJ   rK   rT   `   s   zFixImports.build_patternc                    s   |   | _tt|   d S N)rT   PATTERNsuperrU   compile_patternrW   	__class__rJ   rK   r\   c   s   
zFixImports.compile_patternc                    sH   t t| j  |}|r"d|vr t fddt|dD r dS |S dS )Nbare_with_attrc                 3   s    | ]} |V  qd 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   zFixImports.matchc                    s   t t| || i | _d S rY   )r[   rU   
start_treereplace)rX   treefilenamer]   rJ   rK   rh   v   s   
zFixImports.start_treec                 C   s   | d}|r9|j}| j| }|t||jd d|v r"|| j|< d|v r5| |}|r7| || d S d S d S |d d }| j |j}|rT|t||jd d S d S )Nmodule_name)prefixname_importmultiple_importsr_       )getvaluerQ   ri   r   rm   rb   	transform)rX   rf   rg   
import_modmod_namenew_name	bare_namerJ   rJ   rK   rs   z   s$   



zFixImports.transform)__name__
__module____qualname__BM_compatiblekeep_line_orderMAPPINGrQ   	run_orderrT   r\   rb   rh   rs   __classcell__rJ   rJ   r]   rK   rU   U   s    rU   N)__doc__ r   
fixer_utilr   r   r}   rL   rT   BaseFixrU   rJ   rJ   rJ   rK   <module>   s    	
 !"#5