
mKc           @   s  d  Z  d d k Z d d k l Z l Z l Z l Z l Z l Z l Z l	 Z	 l
 Z
 l Z l Z l Z l Z l Z d d k Z d d k Z d d d d d g Z d	   Z d
 d d     YZ e   Z d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ e d j o d d k Z d d k Z e e i d  i    Z! e e! e i" i# e i d  d d  Z$ x@ e$ i%   D]. Z& e$ i' e&  Z( e( Ge( i)   Ge( i*   GHqWn d S(   s2   Interface to the compiler's internal symbol tablesiN(   t   USEt
   DEF_GLOBALt	   DEF_LOCALt	   DEF_PARAMt
   DEF_IMPORTt	   DEF_BOUNDt   OPT_IMPORT_STARt   OPT_EXECt   OPT_BARE_EXECt	   SCOPE_OFFt
   SCOPE_MASKt   FREEt   GLOBAL_IMPLICITt   GLOBAL_EXPLICITt   symtablet   SymbolTablet   Classt   Functiont   Symbolc         C   sN   t  i |  | |  } x) | i   D] } | i d j o Pq" q" Wt | |  S(   Nt   top(   t	   _symtableR   t
   itervaluest   namet   _newSymbolTable(   t   codet   filenamet   compile_typet   rawR   (    (    s   /usr/lib/python2.6/symtable.pyR      s     	t   SymbolTableFactoryc           B   s#   e  Z d    Z d   Z d   Z RS(   c         C   s   t  i   |  _ d  S(   N(   t   weakreft   WeakValueDictionaryt   _SymbolTableFactory__memo(   t   self(    (    s   /usr/lib/python2.6/symtable.pyt   __init__   s    c         C   sO   | i  t i j o t | |  S| i  t i j o t | |  St | |  S(   N(   t   typeR   t   TYPE_FUNCTIONR   t
   TYPE_CLASSR   R   (   R    t   tableR   (    (    s   /usr/lib/python2.6/symtable.pyt   new   s
    c         C   sS   | | f } |  i  i | d   } | d  j o! |  i | |  } |  i  | <n | S(   N(   R   t   gett   NoneR&   (   R    R%   R   t   keyt   obj(    (    s   /usr/lib/python2.6/symtable.pyt   __call__   s
    !(   t   __name__t
   __module__R!   R&   R+   (    (    (    s   /usr/lib/python2.6/symtable.pyR      s   		c           B   s   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z RS(   c         C   s   | |  _  | |  _ h  |  _ d  S(   N(   t   _tablet	   _filenamet   _symbols(   R    t	   raw_tableR   (    (    s   /usr/lib/python2.6/symtable.pyR!   +   s    		c         C   sq   |  i  t j o
 d } n d |  i  i } |  i i d j o d i | |  i  Sd i | |  i i |  i  Sd  S(   Nt    s   %s t   globals   <{0}SymbolTable for module {1}>s   <{0}SymbolTable for {1} in {2}>(   t	   __class__R   R,   R.   R   t   formatR/   (   R    t   kind(    (    s   /usr/lib/python2.6/symtable.pyt   __repr__0   s    
		c         C   s   |  i  i t i j o d S|  i  i t i j o d S|  i  i t i j o d S|  i  i d j p t d i |  i  i   d  S(	   Nt   modulet   functiont   classi   i   i   s   unexpected type: {0}(   i   i   i   (   R.   R"   R   t   TYPE_MODULER#   R$   t   AssertionErrorR5   (   R    (    (    s   /usr/lib/python2.6/symtable.pyt   get_type=   s    c         C   s
   |  i  i S(   N(   R.   t   id(   R    (    (    s   /usr/lib/python2.6/symtable.pyt   get_idG   s    c         C   s
   |  i  i S(   N(   R.   R   (   R    (    (    s   /usr/lib/python2.6/symtable.pyt   get_nameJ   s    c         C   s
   |  i  i S(   N(   R.   t   lineno(   R    (    (    s   /usr/lib/python2.6/symtable.pyt
   get_linenoM   s    c         C   s'   t  |  i i t i j o |  i i  S(   N(   t   boolR.   R"   R   R#   t	   optimized(   R    (    (    s   /usr/lib/python2.6/symtable.pyt   is_optimizedP   s    c         C   s   t  |  i i  S(   N(   RC   R.   t   nested(   R    (    (    s   /usr/lib/python2.6/symtable.pyt	   is_nestedT   s    c         C   s   t  |  i i  S(   N(   RC   R.   t   children(   R    (    (    s   /usr/lib/python2.6/symtable.pyt   has_childrenW   s    c         C   s   t  |  i i t t B@ S(   s"   Return true if the scope uses exec(   RC   R.   RD   R   R   (   R    (    (    s   /usr/lib/python2.6/symtable.pyt   has_execZ   s    c         C   s   t  |  i i t @ S(   s&   Return true if the scope uses import *(   RC   R.   RD   R   (   R    (    (    s   /usr/lib/python2.6/symtable.pyt   has_import_star^   s    c         C   s   |  i  i i   S(   N(   R.   t   symbolst   keys(   R    (    (    s   /usr/lib/python2.6/symtable.pyt   get_identifiersb   s    c         C   sc   |  i  i |  } | d  j o@ |  i i | } |  i |  } t | | |  } |  i  | <n | S(   N(   R0   R'   R(   R.   RL   t   _SymbolTable__check_childrenR   (   R    R   t   symt   flagst
   namespaces(    (    s   /usr/lib/python2.6/symtable.pyt   lookupe   s    !c         C   s.   g  } |  i    D] } | |  i |  q ~ S(   N(   RN   RS   (   R    t   _[1]t   ident(    (    s   /usr/lib/python2.6/symtable.pyt   get_symbolsm   s    c         C   sE   g  } |  i  i D]- } | i | j o | t | |  i  q q ~ S(   N(   R.   RH   R   R   R/   (   R    R   RT   t   st(    (    s   /usr/lib/python2.6/symtable.pyt   __check_childrenp   s    c         C   s1   g  } |  i  i D] } | t | |  i  q ~ S(   N(   R.   RH   R   R/   (   R    RT   RW   (    (    s   /usr/lib/python2.6/symtable.pyt   get_childrenu   s    (   R,   R-   R!   R7   R=   R?   R@   RB   RE   RG   RI   RJ   RK   RN   RS   RV   RO   RY   (    (    (    s   /usr/lib/python2.6/symtable.pyR   )   s    			
												c           B   sM   e  Z d Z d Z d Z d Z d    Z d   Z d   Z	 d   Z
 d   Z RS(   c         C   sF   t  g  } |  i   D]( } | |  i i |  o | | q q ~  S(   N(   t   tupleRN   R.   RL   (   R    t	   test_funcRT   RU   (    (    s   /usr/lib/python2.6/symtable.pyt   __idents_matching   s    c         C   s0   |  i  d  j o |  i d    |  _  n |  i  S(   Nc         S   s   |  t  @S(    (   R   (   t   x(    (    s   /usr/lib/python2.6/symtable.pyt   <lambda>   s    (   t   _Function__paramsR(   t   _Function__idents_matching(   R    (    (    s   /usr/lib/python2.6/symtable.pyt   get_parameters   s    c         C   s0   |  i  d  j o |  i d    |  _  n |  i  S(   Nc         S   s   |  t  @S(    (   R   (   R]   (    (    s   /usr/lib/python2.6/symtable.pyR^      s    (   t   _Function__localsR(   R`   (   R    (    (    s   /usr/lib/python2.6/symtable.pyt
   get_locals   s    c            sH   |  i  d  j o1 t t f     f d   } |  i |  |  _  n |  i  S(   Nc            s   |  t  ?t @  j S(    (   R	   R
   (   R]   (   t   glob(    s   /usr/lib/python2.6/symtable.pyR^      s    (   t   _Function__globalsR(   R   R   R`   (   R    t   test(    (   Rd   s   /usr/lib/python2.6/symtable.pyt   get_globals   s
    c         C   s6   |  i  d  j o d   } |  i |  |  _  n |  i  S(   Nc         S   s   |  t  ?t @t j S(    (   R	   R
   R   (   R]   (    (    s   /usr/lib/python2.6/symtable.pyR^      s    (   t   _Function__freesR(   R`   (   R    t   is_free(    (    s   /usr/lib/python2.6/symtable.pyt	   get_frees   s    	N(   R,   R-   R(   R_   Rb   Rh   Re   R`   Ra   Rc   Rg   Rj   (    (    (    s   /usr/lib/python2.6/symtable.pyR   z   s   				c           B   s   e  Z d Z d    Z RS(   c         C   sT   |  i  d  j o= h  } x! |  i i D] } d | | i <q# Wt |  |  _  n |  i  S(   Ni   (   t   _Class__methodsR(   R.   RH   R   RZ   (   R    t   dRW   (    (    s   /usr/lib/python2.6/symtable.pyt   get_methods   s     N(   R,   R-   R(   Rk   Rm   (    (    (    s   /usr/lib/python2.6/symtable.pyR      s   c           B   s   e  Z d d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   c         C   s7   | |  _  | |  _ | t ?t @|  _ | p d |  _ d  S(   N(    (   t   _Symbol__namet   _Symbol__flagsR	   R
   t   _Symbol__scopet   _Symbol__namespaces(   R    R   RQ   RR   (    (    s   /usr/lib/python2.6/symtable.pyR!      s    		c         C   s   d i  |  i  S(   Ns   <symbol {0!r}>(   R5   Rn   (   R    (    (    s   /usr/lib/python2.6/symtable.pyR7      s    c         C   s   |  i  S(   N(   Rn   (   R    (    (    s   /usr/lib/python2.6/symtable.pyR@      s    c         C   s   t  |  i t i @ S(   N(   RC   Ro   R   R    (   R    (    (    s   /usr/lib/python2.6/symtable.pyt   is_referenced   s    c         C   s   t  |  i t @ S(   N(   RC   Ro   R   (   R    (    (    s   /usr/lib/python2.6/symtable.pyt   is_parameter   s    c         C   s   t  |  i t t f j  S(   N(   RC   Rp   R   R   (   R    (    (    s   /usr/lib/python2.6/symtable.pyt	   is_global   s    c         C   s   t  i d t d  t S(   Ns+   is_vararg() is obsolete and will be removedi   (   t   warningst   warnt   DeprecationWarningt   False(   R    (    (    s   /usr/lib/python2.6/symtable.pyt	   is_vararg   s    	
c         C   s   t  i d t d  t S(   Ns/   is_keywordarg() is obsolete and will be removedi   (   Ru   Rv   Rw   Rx   (   R    (    (    s   /usr/lib/python2.6/symtable.pyt   is_keywordarg   s    	
c         C   s   t  |  i t j  S(   N(   RC   Rp   R   (   R    (    (    s   /usr/lib/python2.6/symtable.pyt   is_declared_global   s    c         C   s   t  |  i t @ S(   N(   RC   Ro   R   (   R    (    (    s   /usr/lib/python2.6/symtable.pyt   is_local   s    c         C   s   t  |  i t j  S(   N(   RC   Rp   R   (   R    (    (    s   /usr/lib/python2.6/symtable.pyRi      s    c         C   s   t  |  i t @ S(   N(   RC   Ro   R   (   R    (    (    s   /usr/lib/python2.6/symtable.pyt   is_imported   s    c         C   s   t  |  i t @ S(   N(   RC   Ro   R   (   R    (    (    s   /usr/lib/python2.6/symtable.pyt   is_assigned   s    c         C   s   t  i d t d  d  S(   Ns-   is_in_tuple() is obsolete and will be removedi   (   Ru   Rv   Rw   (   R    (    (    s   /usr/lib/python2.6/symtable.pyt   is_in_tuple   s    	c         C   s   t  |  i  S(   s  Returns true if name binding introduces new namespace.

        If the name is used as the target of a function or class
        statement, this will be true.

        Note that a single name can be bound to multiple objects.  If
        is_namespace() is true, the name may also be bound to other
        objects, like an int or list, that does not introduce a new
        namespace.
        (   RC   Rq   (   R    (    (    s   /usr/lib/python2.6/symtable.pyt   is_namespace   s    c         C   s   |  i  S(   s.   Return a list of namespaces bound to this name(   Rq   (   R    (    (    s   /usr/lib/python2.6/symtable.pyt   get_namespaces   s    c         C   s.   t  |  i  d j o t d  n |  i d S(   s   Returns the single namespace bound to this name.

        Raises ValueError if the name is bound to multiple namespaces.
        i   s$   name is bound to multiple namespacesi    (   t   lenRq   t
   ValueError(   R    (    (    s   /usr/lib/python2.6/symtable.pyt   get_namespace   s    N(   R,   R-   R(   R!   R7   R@   Rr   Rs   Rt   Ry   Rz   R{   R|   Ri   R}   R~   R   R   R   R   (    (    (    s   /usr/lib/python2.6/symtable.pyR      s"   															t   __main__i    i   t   exec(    (+   t   __doc__R   R    R   R   R   R   R   R   R   R   R	   R
   R   R   R   Ru   R   t   __all__R   R   R   t   objectR   R   R   R   R,   t   ost   syst   opent   argvt   readt   srct   patht   splitt   modRN   RU   RS   t   infoR|   R   (    (    (    s   /usr/lib/python2.6/symtable.pyt   <module>   s(   ^		Q$N) 