�`^c@s�dZddlZddlmZmZmZmZmZmZmZm Z m
Z
mZmZm
Z
mZmZmZmZddlZdddddgZd �Zd
dd��YZe�Zdefd��YZdefd
��YZdefd��YZdefd��YZedkr�ddlZddlZeej d�j!�Z"ee"ej#j$ej d�dd�Z%x?e%j&�D].Z'e%j(e'�Z)e)Ge)j*�Ge)j+�GHq�WndS(s2Interface to the compiler's internal symbol tablesi�N(tUSEt
DEF_GLOBALt DEF_LOCALt DEF_PARAMt
DEF_IMPORTt DEF_BOUNDtOPT_IMPORT_STARtOPT_EXECt
OPT_BARE_EXECt SCOPE_OFFt
SCOPE_MASKtFREEtGLOBAL_IMPLICITtGLOBAL_EXPLICITtCELLtLOCALtsymtabletSymbolTabletClasstFunctiontSymbolcCs"tj|||�}t||�S(N(t _symtableRt_newSymbolTable(tcodetfilenametcompile_typettop((s/sys/lib/python2.7/symtable.pyRstSymbolTableFactorycBs#eZd�Zd�Zd�ZRS(cCstj�|_dS(N(tweakreftWeakValueDictionaryt_SymbolTableFactory__memo(tself((s/sys/lib/python2.7/symtable.pyt__init__scCsK|jtjkrt||�S|jtjkr>t||�St||�S(N(ttypeRt
TYPE_FUNCTIONRt
TYPE_CLASSRR(RttableR((s/sys/lib/python2.7/symtable.pytnews
cCsQ||f}|jj|d�}|dkrM|j||�}|j|<n|S(N(RtgettNoneR%(RR$Rtkeytobj((s/sys/lib/python2.7/symtable.pyt__call__s
(t__name__t
__module__R R%R*(((s/sys/lib/python2.7/symtable.pyRs cBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z
d �Zd
�Zd�Z
d�Zd
�Zd�Zd�ZRS(cCs||_||_i|_dS(N(t_tablet _filenamet_symbols(Rt raw_tableR((s/sys/lib/python2.7/symtable.pyR 's cCsm|jtkrd}nd|jj}|jjdkrMdj||j�Sdj||jj|j�SdS(Nts%s tglobals<{0}SymbolTable for module {1}>s<{0}SymbolTable for {1} in {2}>(t __class__RR+R-tnametformatR.(Rtkind((s/sys/lib/python2.7/symtable.pyt__repr__,s cCsO|jjtjkrdS|jjtjkr2dS|jjtjkrKdSdS(Ntmoduletfunctiontclass(R-R!RtTYPE_MODULER"R#(R((s/sys/lib/python2.7/symtable.pytget_type9scCs
|jjS(N(R-tid(R((s/sys/lib/python2.7/symtable.pytget_idCscCs
|jjS(N(R-R4(R((s/sys/lib/python2.7/symtable.pytget_nameFscCs
|jjS(N(R-tlineno(R((s/sys/lib/python2.7/symtable.pyt
get_linenoIscCs&t|jjtjko"|jj�S(N(tboolR-R!RR"t optimized(R((s/sys/lib/python2.7/symtable.pytis_optimizedLscCst|jj�S(N(RBR-tnested(R((s/sys/lib/python2.7/symtable.pyt is_nestedPscCst|jj�S(N(RBR-tchildren(R((s/sys/lib/python2.7/symtable.pythas_childrenSscCst|jjttB@�S(s"Return true if the scope uses exec(RBR-RCRR(R((s/sys/lib/python2.7/symtable.pythas_execVscCst|jjt@�S(s&Return true if the scope uses import *(RBR-RCR(R((s/sys/lib/python2.7/symtable.pythas_import_starZscCs|jjj�S(N(R-tsymbolstkeys(R((s/sys/lib/python2.7/symtable.pytget_identifiers^scCsa|jj|�}|dkr]|jj|}|j|�}t|||�}|j|<n|S(N(R/R&R'R-RKt_SymbolTable__check_childrenR(RR4tsymtflagst
namespaces((s/sys/lib/python2.7/symtable.pytlookupas cCs&g|j�D]}|j|�^q
S(N(RMRR(Rtident((s/sys/lib/python2.7/symtable.pytget_symbolsiscCs8g|jjD]'}|j|kr
t||j�^q
S(N(R-RGR4RR.(RR4tst((s/sys/lib/python2.7/symtable.pyt__check_childrenlscCs)g|jjD]}t||j�^q
S(N(R-RGRR.(RRU((s/sys/lib/python2.7/symtable.pytget_childrenqs(R+R,R R7R<R>R?RARDRFRHRIRJRMRRRTRNRW(((s/sys/lib/python2.7/symtable.pyR%s
cBsMeZdZdZdZdZd�Zd�Zd�Z d�Z
d�ZRS(cCs9tg|j�D]"}||jj|�r|^q�S(N(ttupleRMR-RK(Rt test_funcRS((s/sys/lib/python2.7/symtable.pyt__idents_matching~scCs.|jdkr'|jd��|_n|jS(NcSs|t@S(N(R(tx((s/sys/lib/python2.7/symtable.pyt<lambda>�s(t_Function__paramsR't_Function__idents_matching(R((s/sys/lib/python2.7/symtable.pytget_parameters�scsF|jdkr?ttf��fd�}|j|�|_n|jS(Ncs|t?t@�kS(N(R R
(R[(tlocs(s/sys/lib/python2.7/symtable.pyR\�s(t_Function__localsR'RRR^(Rttest((R`s/sys/lib/python2.7/symtable.pyt
get_locals�s
csF|jdkr?ttf��fd�}|j|�|_n|jS(Ncs|t?t@�kS(N(R R
(R[(tglob(s/sys/lib/python2.7/symtable.pyR\�s(t_Function__globalsR'RR
R^(RRb((Rds/sys/lib/python2.7/symtable.pytget_globals�s
cCs4|jdkr-d�}|j|�|_n|jS(NcSs|t?t@tkS(N(R R
R(R[((s/sys/lib/python2.7/symtable.pyR\�s(t_Function__freesR'R^(Rtis_free((s/sys/lib/python2.7/symtable.pyt get_frees�s N(R+R,R'R]RaRgReR^R_RcRfRi(((s/sys/lib/python2.7/symtable.pyRvs cBseZdZd�ZRS(cCsR|jdkrKi}x!|jjD]}d||j<q"Wt|�|_n|jS(Ni(t_Class__methodsR'R-RGR4RX(RtdRU((s/sys/lib/python2.7/symtable.pytget_methods�sN(R+R,R'RjRl(((s/sys/lib/python2.7/symtable.pyR�scBs�eZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z
d�Zd �Zd
�Z
d�Zd�Zd
�ZRS(cCs6||_||_|t?t@|_|p,d|_dS(N((t
_Symbol__namet_Symbol__flagsR R
t_Symbol__scopet_Symbol__namespaces(RR4RPRQ((s/sys/lib/python2.7/symtable.pyR �s cCsdj|j�S(Ns<symbol {0!r}>(R5Rm(R((s/sys/lib/python2.7/symtable.pyR7�scCs|jS(N(Rm(R((s/sys/lib/python2.7/symtable.pyR?�scCst|jtj@�S(N(RBRnRR(R((s/sys/lib/python2.7/symtable.pyt
is_referenced�scCst|jt@�S(N(RBRnR(R((s/sys/lib/python2.7/symtable.pytis_parameter�scCst|jttfk�S(N(RBRoRR
(R((s/sys/lib/python2.7/symtable.pyt is_global�scCst|jtk�S(N(RBRoR
(R((s/sys/lib/python2.7/symtable.pytis_declared_global�scCst|jt@�S(N(RBRnR(R((s/sys/lib/python2.7/symtable.pytis_local�scCst|jtk�S(N(RBRoR(R((s/sys/lib/python2.7/symtable.pyRh�scCst|jt@�S(N(RBRnR(R((s/sys/lib/python2.7/symtable.pytis_imported�scCst|jt@�S(N(RBRnR(R((s/sys/lib/python2.7/symtable.pytis_assigned�scCs
t|j�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.
(RBRp(R((s/sys/lib/python2.7/symtable.pytis_namespace�scCs|jS(s.Return a list of namespaces bound to this name(Rp(R((s/sys/lib/python2.7/symtable.pytget_namespaces�scCs,t|j�dkr!td�n|jdS(s�Returns the single namespace bound to this name.
Raises ValueError if the name is bound to multiple namespaces.
is$name is bound to multiple namespacesi(tlenRpt
ValueError(R((s/sys/lib/python2.7/symtable.pyt
get_namespace�sN(R+R,R'R R7R?RqRrRsRtRuRhRvRwRxRyR|(((s/sys/lib/python2.7/symtable.pyR�s
t__main__iitexec((,t__doc__RRRRRRRRRRR R
RRR
RRRt__all__RRRtobjectRRRRR+tostsystopentargvtreadtsrctpathtsplittmodRMRSRRtinfoRuRx(((s/sys/lib/python2.7/symtable.pyt<module>s$j Q&
@)
|