
"Ic           @   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%   /mit/python/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%   /mit/python/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%   /mit/python/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%   /mit/python/lib/python2.6/symtable.pyt   __call__   s
    !(   t   __name__t
   __module__R!   R&   R+   (    (    (    s%   /mit/python/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%   /mit/python/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%   /mit/python/lib/python2.6/symtable.pyt   __repr__0   s    
		c         C   sU   |  i  i t i j o d S|  i  i t i j o d S|  i  i t i j o d Sd  S(   Nt   modulet   functiont   class(   R.   R"   R   t   TYPE_MODULER#   R$   (   R    (    (    s%   /mit/python/lib/python2.6/symtable.pyt   get_type=   s    c         C   s
   |  i  i S(   N(   R.   t   id(   R    (    (    s%   /mit/python/lib/python2.6/symtable.pyt   get_idG   s    c         C   s
   |  i  i S(   N(   R.   R   (   R    (    (    s%   /mit/python/lib/python2.6/symtable.pyt   get_nameJ   s    c         C   s
   |  i  i S(   N(   R.   t   lineno(   R    (    (    s%   /mit/python/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%   /mit/python/lib/python2.6/symtable.pyt   is_optimizedP   s    c         C   s   t  |  i i  S(   N(   RB   R.   t   nested(   R    (    (    s%   /mit/python/lib/python2.6/symtable.pyt	   is_nestedT   s    c         C   s   t  |  i i  S(   N(   RB   R.   t   children(   R    (    (    s%   /mit/python/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(   RB   R.   RC   R   R   (   R    (    (    s%   /mit/python/lib/python2.6/symtable.pyt   has_execZ   s    c         C   s   t  |  i i t @ S(   s&   Return true if the scope uses import *(   RB   R.   RC   R   (   R    (    (    s%   /mit/python/lib/python2.6/symtable.pyt   has_import_star^   s    c         C   s   |  i  i i   S(   N(   R.   t   symbolst   keys(   R    (    (    s%   /mit/python/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.   RK   t   _SymbolTable__check_childrenR   (   R    R   t   symt   flagst
   namespaces(    (    s%   /mit/python/lib/python2.6/symtable.pyt   lookupe   s    !c         C   s.   g  } |  i    D] } | |  i |  q ~ S(   N(   RM   RR   (   R    t   _[1]t   ident(    (    s%   /mit/python/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.   RG   R   R   R/   (   R    R   RS   t   st(    (    s%   /mit/python/lib/python2.6/symtable.pyt   __check_childrenp   s    c         C   s1   g  } |  i  i D] } | t | |  i  q ~ S(   N(   R.   RG   R   R/   (   R    RS   RV   (    (    s%   /mit/python/lib/python2.6/symtable.pyt   get_childrenu   s    (   R,   R-   R!   R7   R<   R>   R?   RA   RD   RF   RH   RI   RJ   RM   RR   RU   RN   RX   (    (    (    s%   /mit/python/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   tupleRM   R.   RK   (   R    t	   test_funcRS   RT   (    (    s%   /mit/python/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%   /mit/python/lib/python2.6/symtable.pyt   <lambda>   s    (   t   _Function__paramsR(   t   _Function__idents_matching(   R    (    (    s%   /mit/python/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%   /mit/python/lib/python2.6/symtable.pyR]      s    (   t   _Function__localsR(   R_   (   R    (    (    s%   /mit/python/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%   /mit/python/lib/python2.6/symtable.pyR]      s    (   t   _Function__globalsR(   R   R   R_   (   R    t   test(    (   Rc   s%   /mit/python/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%   /mit/python/lib/python2.6/symtable.pyR]      s    (   t   _Function__freesR(   R_   (   R    t   is_free(    (    s%   /mit/python/lib/python2.6/symtable.pyt	   get_frees   s    	N(   R,   R-   R(   R^   Ra   Rg   Rd   R_   R`   Rb   Rf   Ri   (    (    (    s%   /mit/python/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.   RG   R   RY   (   R    t   dRV   (    (    s%   /mit/python/lib/python2.6/symtable.pyt   get_methods   s     N(   R,   R-   R(   Rj   Rl   (    (    (    s%   /mit/python/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 RS(   c         C   s7   | |  _  | |  _ | t ?t @|  _ | p d |  _ d  S(   N(    (   t   _Symbol__namet   _Symbol__flagsR	   R
   t   _Symbol__scopet   _Symbol__namespaces(   R    R   RP   RQ   (    (    s%   /mit/python/lib/python2.6/symtable.pyR!      s    		c         C   s   d i  |  i  S(   Ns   <symbol {0!r}>(   R5   Rm   (   R    (    (    s%   /mit/python/lib/python2.6/symtable.pyR7      s    c         C   s   |  i  S(   N(   Rm   (   R    (    (    s%   /mit/python/lib/python2.6/symtable.pyR?      s    c         C   s   t  |  i t i @ S(   N(   RB   Rn   R   R    (   R    (    (    s%   /mit/python/lib/python2.6/symtable.pyt   is_referenced   s    c         C   s   t  |  i t @ S(   N(   RB   Rn   R   (   R    (    (    s%   /mit/python/lib/python2.6/symtable.pyt   is_parameter   s    c         C   s   t  |  i t t f j  S(   N(   RB   Ro   R   R   (   R    (    (    s%   /mit/python/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%   /mit/python/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   (   Rt   Ru   Rv   Rw   (   R    (    (    s%   /mit/python/lib/python2.6/symtable.pyt   is_keywordarg   s    	
c         C   s   t  |  i t @ S(   N(   RB   Rn   R   (   R    (    (    s%   /mit/python/lib/python2.6/symtable.pyt   is_local   s    c         C   s   t  |  i t j  S(   N(   RB   Ro   R   (   R    (    (    s%   /mit/python/lib/python2.6/symtable.pyRh      s    c         C   s   t  |  i t @ S(   N(   RB   Rn   R   (   R    (    (    s%   /mit/python/lib/python2.6/symtable.pyt   is_imported   s    c         C   s   t  |  i t @ S(   N(   RB   Rn   R   (   R    (    (    s%   /mit/python/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   (   Rt   Ru   Rv   (   R    (    (    s%   /mit/python/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.
        (   RB   Rp   (   R    (    (    s%   /mit/python/lib/python2.6/symtable.pyt   is_namespace   s    c         C   s   |  i  S(   s.   Return a list of namespaces bound to this name(   Rp   (   R    (    (    s%   /mit/python/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   lenRp   t
   ValueError(   R    (    (    s%   /mit/python/lib/python2.6/symtable.pyt   get_namespace   s    N(   R,   R-   R(   R!   R7   R?   Rq   Rr   Rs   Rx   Ry   Rz   Rh   R{   R|   R}   R~   R   R   (    (    (    s%   /mit/python/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   Rt   R   t   __all__R   R   R   t   objectR   R   R   R   R,   t   ost   syst   opent   argvt   readt   srct   patht   splitt   modRM   RT   RR   t   infoRz   R~   (    (    (    s%   /mit/python/lib/python2.6/symtable.pyt   <module>   s(   ^		Q$K) 