//usr/lib64/lib64//lib64//python2.7/ó
ÛœSec @ 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 unkown 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" t
have_localt
have_absolutet mod_namet new( ( s0 /usr/lib64/python2.7/lib2to3/fixes/fix_import.pyt transform3 s,
c C s¡ | j d ƒ r t S| j d d ƒ d } t | j ƒ } t | | ƒ } t t t | ƒ d ƒ ƒ sf t Sx4 d t d d d d g D] } t | | ƒ r t Sq Wt S(
Nu .i i s __init__.pys .pys .pycs .sos .sls .pyd( t
startswithR' t splitR t filenameR R R R( ( R t imp_namet base_patht ext( ( s0 /usr/lib64/python2.7/lib2to3/fixes/fix_import.pyR% U s ( t __name__t
__module__R( t
BM_compatiblet PATTERNR R0 R% ( ( ( s0 /usr/lib64/python2.7/lib2to3/fixes/fix_import.pyR &