????

Your IP : 3.135.209.235


Current Path : /usr/lib/python3.6/site-packages/libfuturize/fixes/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/libfuturize/fixes/__pycache__/fix_absolute_import.cpython-36.pyc

3

�cD�@sddZddlmZmZmZmZddlmZddlm	Z	m
Z
ddlmZddlm
Z
Gdd�de�Zd	S)
a�
Fixer for import statements, with a __future__ import line.

Based on lib2to3/fixes/fix_import.py, but extended slightly so it also
supports Cython modules.

If spam is being imported from the local directory, this import:
    from spam import eggs
becomes:
    from __future__ import absolute_import
    from .spam import eggs

and this import:
    import spam
becomes:
    from __future__ import absolute_import
    from . import spam
�)�dirname�join�exists�sep)�	FixImport)�
FromImport�syms)�traverse_imports)�
future_importc@s eZdZdZdd�Zdd�ZdS)�FixAbsoluteImport�	cCs�|jr
dS|d}|jtjkrdxt|d�s6|jd}q W|j|j�r�d|j|_|j�t	d|�nhd}d}x$t
|�D]}|j|�r�d}qvd}qvW|r�|r�|j|d	�dStd|g�}|j
|_
t	d|�|SdS)
z�
        Copied from FixImport.transform(), but with this line added in
        any modules that had implicit relative imports changed:

            from __future__ import absolute_import"
        N�imp�valuer�.Zabsolute_importFTz#absolute and local imports together)�skip�typerZimport_from�hasattrZchildren�probably_a_local_importrZchangedr
r	Zwarningr�prefix)�selfZnode�resultsr
Z
have_localZ
have_absoluteZmod_name�new�r�)/usr/lib/python3.6/fix_absolute_import.py�	transforms0

zFixAbsoluteImport.transformcCsx|jd�rdS|jdd�d}t|j�}t||�}ttt|�d��sHdSx*dtddd	d
dgD]}t||�r\dSq\WdS)
zq
        Like the corresponding method in the base class, but this also
        supports Cython modules.
        rF�rz__init__.pyz.pyz.pycz.soz.slz.pydz.pyxT)�
startswith�splitr�filenamerrr)rZimp_name�	base_pathZextrrrrIs


z)FixAbsoluteImport.probably_a_local_importN)�__name__�
__module__�__qualname__Z	run_orderrrrrrrrs*rN)�__doc__Zos.pathrrrrZlib2to3.fixes.fix_importrZlib2to3.fixer_utilrrr	Zlibfuturize.fixer_utilr
rrrrr�<module>s