ok
Direktori : /opt/alt/python35/lib64/python3.5/lib2to3/fixes/__pycache__/ |
Current File : //opt/alt/python35/lib64/python3.5/lib2to3/fixes/__pycache__/fix_import.cpython-35.pyc |
K�Ma� � @ s} d Z d d l m Z d d l m Z m Z m Z m Z d d l m Z m Z m Z d d � Z Gd d � d e j � Z d 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�tokenc c s� | g } x� | r� | j � } | j t j k r; | j Vq | j t j k rn d j d d � | j D� � Vq | j t j k r� | j | j d � q | j t j k r� | j | j d d d � � q t d � � q Wd S) zF Walks over all the names imported in a dotted_as_names node. � c S s g | ] } | j � q S� )�value)�.0Zchr r �=/opt/alt/python35/lib64/python3.5/lib2to3/fixes/fix_import.py� <listcomp> s z$traverse_imports.<locals>.<listcomp>r Nr zunknown node type���)�pop�typer �NAMEr r Zdotted_namer �childrenZdotted_as_name�appendZdotted_as_names�extend�AssertionError)�names�pending�noder r r �traverse_imports s ! r c sF e Z d Z d Z d Z � f d d � Z d d � Z d d � Z � S) � FixImportTzj import_from< 'from' imp=any 'import' ['('] any [')'] > | import_name< 'import' imp=any > c s/ t t | � j | | � d | j k | _ d S)NZabsolute_import)�superr � start_treeZfuture_features�skip)�selfZtree�name)� __class__r r r / s zFixImport.start_treec C s | j r d S| d } | j t j k r{ x t | d � sK | j d } q, W| j | j � r� d | j | _ | j � n� d } d } x2 t | � D]$ } | j | � r� d } q� d } q� W| r� | r� | j | d � d St d | g � } | j | _ | Sd S)N�impr r �.FTz#absolute and local imports together) r r r Zimport_from�hasattrr �probably_a_local_importr Zchangedr Zwarningr �prefix)r! r Zresultsr$ Z have_localZ have_absoluteZmod_name�newr r r � transform3 s, zFixImport.transformc C s� | j d � r d S| j d d � d } t | j � } t | | � } t t t | � d � � sf d Sx4 d t d d d d g D] } t | | � r d Sq Wd S)Nr% F� r z__init__.pyz.pyz.pycz.soz.slz.pydT)� startswith�splitr �filenamer r r )r! Zimp_name� base_pathZextr r r r'