Your IP : 3.15.3.17


Current Path : /opt/alt/python35/lib64/python3.5/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/lib2to3/fixes/__pycache__/fix_import.cpython-35.opt-2.pyc



���]��@swddlmZddlmZmZmZmZddlmZm	Z	m
Z
dd�ZGdd�dej�Z
d	S)
�)�
fixer_base�)�dirname�join�exists�sep)�
FromImport�syms�tokenccs�|g}x�|r�|j�}|jtjkr;|jVq|jtjkrndjdd�|jD��Vq|jtj	kr�|j
|jd�q|jtjkr�|j|jddd��qt
d��qWdS)N�cSsg|]}|j�qS�)�value)�.0Zchrr�//opt/alt/python35/lib64/python3.5/fix_import.py�
<listcomp>s	z$traverse_imports.<locals>.<listcomp>rrzunknown node type���)�pop�typer
�NAMEr
r	Zdotted_namer�childrenZdotted_as_name�appendZdotted_as_names�extend�AssertionError)�names�pending�noderrr�traverse_importss		! rcsFeZdZdZdZ�fdd�Zdd�Zdd�Z�S)	�	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}|jtjkr{x t|d�sK|jd}q,W|j|j�r�d|j|_|j�n�d}d}x2t	|�D]$}|j|�r�d}q�d}q�W|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
Zchangedr�warningr�prefix)r!r�resultsr$Z
have_localZ
have_absoluteZmod_name�newrrr�	transform3s,	

	
zFixImport.transformcCs�|jd�rdS|jdd�d}t|j�}t||�}ttt|�d��sfdSx4dtddd	d
gD]}t||�rdSqWdS)Nr%F�rz__init__.pyz.pyz.pycz.soz.slz.pydT)�
startswith�splitr�filenamerrr)r!Zimp_name�	base_path�extrrrr'Usz!FixImport.probably_a_local_import)�__name__�
__module__�__qualname__Z
BM_compatibleZPATTERNrr,r'rr)r#rr&s
"rN)rrZos.pathrrrrZ
fixer_utilrr	r
rZBaseFixrrrrr�<module>s"

?>