%PDF- %PDF-
Direktori : /usr/local/lib/python2.7/lib2to3/fixes/ |
Current File : //usr/local/lib/python2.7/lib2to3/fixes/fix_import.pyc |
ó Pêáac @ 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( ( s4 /usr/local/lib/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( ( s4 /usr/local/lib/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"