AlkantarClanX12
Current Path : /lib64/python2.7/lib2to3/fixes/ |
Current File : //lib64/python2.7/lib2to3/fixes/fix_import.pyc |
� {fc @ sz 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 � Z d e j f d � � YZ d S( s� 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 i ( t fixer_basei����( t dirnamet joint existst sep( t FromImportt symst tokenc c s� | g } x� | r� | j � } | j t j k r; | j Vq | j t j k rw d j g | j D] } | j ^ q] � 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( sF Walks over all the names imported in a dotted_as_names node. t i Ni����s unknown node type( t popt typeR t NAMEt valueR t dotted_nameR t childrent dotted_as_namet appendt dotted_as_namest extendt AssertionError( t namest pendingt nodet ch( ( s0 /usr/lib64/python2.7/lib2to3/fixes/fix_import.pyt traverse_imports s * t FixImportc B s/ e Z e Z d Z d � Z d � Z d � Z RS( sj import_from< 'from' imp=any 'import' ['('] any [')'] > | import_name< 'import' imp=any > c C s/ t t | � j | | � d | j k | _ d S( Nt absolute_import( t superR t start_treet future_featurest skip( t selft treet name( ( s0 /usr/lib64/python2.7/lib2to3/fixes/fix_import.pyR / s c C s | j r d S| d } | j t j k r~ x t | d � sK | j d } q, W| j | j � rd | j | _ | j � qn� t } t } x2 t | � D]$ } | j | � r� t } q� t } q� W| r� | r� | j | d � n d St d | g � } | j | _ | Sd S( Nt impR i u .s# absolute and local imports together( R R R t import_fromt hasattrR t probably_a_local_importR t changedt FalseR t Truet warningR t prefix( R R t resultsR"