AlkantarClanX12

Your IP : 3.145.176.228


Current Path : /usr/lib64/python3.6/lib2to3/fixes/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/lib2to3/fixes/__pycache__/fix_import.cpython-36.opt-1.pyc

3


 \��@sZdZddlmZddlmZmZmZmZddlm	Z	m
Z
mZdd�ZGdd	�d	ej
�Zd
S)z�Fixer for import statements.
If spam is being imported from the local directory, this import:
    from spam import eggs
Becomes:
    from .spam import eggs

And this import:
    import spam
Becomes:
    from . import spam
�)�
fixer_base�)�dirname�join�exists�sep)�
FromImport�syms�tokenccs�|g}x�|r�|j�}|jtjkr*|jVq|jtjkrPdjdd�|jD��Vq|jtj	krn|j
|jd�q|jtjkr�|j|jddd��qt
d��qWdS)	zF
    Walks over all the names imported in a dotted_as_names node.
    �cSsg|]
}|j�qS�)�value)�.0Zchrr�0/usr/lib64/python3.6/lib2to3/fixes/fix_import.py�
<listcomp>sz$traverse_imports.<locals>.<listcomp>rNrzunknown node type���)�pop�typer
�NAMEr
r	Zdotted_namer�childrenZdotted_as_name�appendZdotted_as_names�extend�AssertionError)�names�pending�noderrr�traverse_importss
rcs4eZdZdZdZ�fdd�Zdd�Zdd�Z�ZS)	�	FixImportTzj
    import_from< 'from' imp=any 'import' ['('] any [')'] >
    |
    import_name< 'import' imp=any >
    cs"tt|�j||�d|jk|_dS)NZabsolute_import)�superr�
start_treeZfuture_features�skip)�selfZtree�name)�	__class__rrr/szFixImport.start_treecCs�|jr
dS|d}|jtjkrZxt|d�s6|jd}q W|j|j�r�d|j|_|j�n^d}d}x$t	|�D]}|j|�r�d}qld}qlW|r�|r�|j
|d�dStd|g�}|j|_|SdS)N�impr
r�.FTz#absolute and local imports together)
r rr	Zimport_from�hasattrr�probably_a_local_importr
ZchangedrZwarningr�prefix)r!rZresultsr$Z
have_localZ
have_absoluteZmod_name�newrrr�	transform3s,

zFixImport.transformcCsv|jd�rdS|jdd�d}t|j�}t||�}ttt|�d��sHdSx(dtddd	d
gD]}t||�rZdSqZWdS)Nr%F�rz__init__.pyz.pyz.pycz.soz.slz.pydT)�
startswith�splitr�filenamerrr)r!Zimp_name�	base_pathZextrrrr'Us


z!FixImport.probably_a_local_import)	�__name__�
__module__�__qualname__Z
BM_compatibleZPATTERNrr*r'�
__classcell__rr)r#rr&s
"rN)�__doc__rrZos.pathrrrrZ
fixer_utilrr	r
rZBaseFixrrrrr�<module>s