AlkantarClanX12

Your IP : 18.226.222.132


Current Path : /opt/alt/python27/lib64/python2.7/compiler/
Upload File :
Current File : //opt/alt/python27/lib64/python2.7/compiler/symbols.pyc

�
^
bc@s=dZddlmZddlmZmZmZmZmZm	Z	ddl
mZddlZddl
Z
dZddd��YZd	efd
��YZdefd��YZd
efd��YZdefd��YZdefd��YZddd��YZd�Zedkr9ddl
Z
ddlmZmZddlZd�Zx�e
jdD]�ZeGHee�Zej �Z!ej"�eje!ed�Z#ee#�Z$ee�Z%e�Z&ee%e&�e&j'e%j�Z(ee$e(�s"HdGeGHe)e$�GHe)e(�GHe
j*d�niZ+e+j,e&j'�e+e%=e+j-�Z'[+x�e#j.�D]�Z&e&j/�r[ge'D]!Z0e0j1e&j2�krte0^qtZ3e4e3�dkr�dGe&j2�GHq.eee&j5��e3dj��s.e&j2�GHe)ee&j5���GHe)e3dj��GHe
j*d�q.q[q[Wq`WndS( sModule symbol-table generatori����(tast(tSC_LOCALtSC_GLOBAL_IMPLICITtSC_GLOBAL_EXPLICITtSC_FREEtSC_CELLt
SC_UNKNOWN(tmangleNitScopecBs�eZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�ZRS(cCs�||_||_i|_i|_i|_i|_i|_i|_g|_d|_
d|_d|_|dk	r�x>t
t|��D]'}||dkr�|||_Pq�q�WndS(Nt_(tnametmoduletdefstusestglobalstparamstfreestcellstchildrentNonetnestedt	generatortklasstrangetlen(tselfR
RRti((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyt__init__s"												
cCsd|jj|jfS(Ns<%s: %s>(t	__class__t__name__R
(R((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyt__repr__%scCs#|jdkr|St||j�S(N(RRR(RR
((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyR(scCsd|j|j|�<dS(Ni(RR(RR
((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pytadd_def-scCsd|j|j|�<dS(Ni(R
R(RR
((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pytadd_use0scCsy|j|�}||jks0||jkr0n||jkrXtd||jf�nd|j|<|jj|�dS(Ns %s in %s is global and parameteri(	RR
RRtSyntaxErrorR
RRR(RR
((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyt
add_global3s
cCs-|j|�}d|j|<d|j|<dS(Ni(RRR(RR
((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyt	add_param=s
cCs@i}|j|j�|j|j�|j|j�|j�S(N(tupdateRR
Rtkeys(Rtd((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyt	get_namesBs
cCs|jj|�dS(N(Rtappend(Rtchild((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyt	add_childIscCs|jS(N(R(R((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pytget_childrenLscCs�tj|jI|jrdp"dIJtjdI|jIJtjdI|jIJtjdI|jIJtjdI|jIJtjdI|jIJdS(NRts
	globals: s	cells: s	defs: s	uses: s	frees:(	tsyststderrR
RRRRR
R(R((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pytDEBUGOs%cCsy||jkrtS||jkr&tS||jkr9tS|jrd||jks`||jkrdt	S|jrqt
StSdS(sbReturn scope of name.

        The scope of a name could be LOCAL, GLOBAL, FREE, or CELL.
        N(RRRRRRRRR
RRR(RR
((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyt
check_nameWs'	cCsr|js
dSi}|j|j�xB|jj�D]1}||jkr3||jkr3d||<q3q3W|j�S(Ni((RR$RR
R%RR(RtfreeR
((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyt
get_free_varsis	cCsQxJ|jD]?}|j�}|j|�}x|D]}|j|�q2Wq
WdS(N(RR2t	add_freestforce_global(RR)RRR
((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pythandle_childrenss

cCsfd|j|<||jkr)|j|=nx6|jD]+}|j|�tkr3|j|�q3q3WdS(s�Force name to be global in scope.

        Some child of the current node had a free reference to name.
        When the child was processed, it was labelled a free
        variable.  Now that all its enclosing scope have been
        processed, the name is known to be a global or builtin.  So
        walk back down the child chain and set the name to be global
        rather than free.

        Be careful to stop if a child does not think the name is
        free.
        iN(RRRR0RR4(RR
R)((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyR4zs


cCsg}x�|D]�}|j|�}|jr�|tksR|tksRt|t�rbd|j|<q|tkr~|j|�qt|t	�r�|t
kr�d|j|<q|tkr|j|�qq
|t
kr�d|j|<q
|tkr
|j|�q
q
W|S(s�Process list of free vars from nested scope.

        Returns a list of names that are either 1) declared global in the
        parent or 2) undefined in a top-level parent.  In either case,
        the nested scope should treat them as globals.
        i(
R0RRRt
isinstancet
ClassScopeRRR(t
FunctionScopeRRR(Rtnamest
child_globalsR
tsc((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyR3�s$
	cCs
|jj�S(N(RR%(R((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyt
get_cell_vars�sN(Rt
__module__RRRRRR R"R#R'R*R+R/R0R2R5R4R3R<(((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyRs"					
							
			tModuleScopecBseZejZd�ZRS(cCs|jd|�dS(Ntglobal(t_ModuleScope__super_init(R((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyR�s(RR=RRR@(((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyR>�s	R8cBseZRS((RR=(((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyR8�stGenExprScopecBs,eZejZdZdd�Zd�ZRS(icCs@|j}|jd7_|jd|||�|jd�dS(Nisgenerator expression<%d>s.0(t_GenExprScope__countert_GenExprScope__super_initR#(RRRR((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyR�s	cCstj|�}|S(N(RR'(RR%((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyR'�sN(RR=RRRCRBRR'(((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyRA�s	tLambdaScopecBs#eZejZdZdd�ZRS(icCs3|j}|jd7_|jd|||�dS(Nis	lambda.%d(t_LambdaScope__countert_LambdaScope__super_init(RRRR((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyR�s	N(RR=RRRFRER(((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyRD�s	R7cBseZejZd�ZRS(cCs|j|||�dS(N(t_ClassScope__super_init(RR
R((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyR�s(RR=RRRG(((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyR7�s	t
SymbolVisitorcBseZd�Zd�ZeZd�Zd�Zd�Zd�Zd�Z	dd�Z
d	�Zd
�Zd�Z
dd�Zd
�Zd�Zd�Zd�Zd�Zdd�Zdd�Zdd�Zdd�Zd�ZejejejfZd�Zd�ZRS(cCsi|_d|_dS(N(tscopesRR(R((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyR�s	cCs2t�}|_|j|<|j|j|�dS(N(R>RRItvisittnode(RRKtscope((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pytvisitModule�scCs�|jr|j|j|�n|j|j�x!|jD]}|j||�q9Wt|j|j|j�}|js�t	|t�r�d|_n||j
|<|j||j�|j|j
|�|j||�dS(Ni(t
decoratorsRJRR
tdefaultsR8RRRR6RIt_do_argstargnamestcodethandle_free_vars(RRKtparenttnRL((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyt
visitFunction�s	
cCs|t|j|j�}|js<t|t�s<t|t�rHd|_n||j|<|j|j|�|j	||�dS(Ni(
RARRRR6R8RIRJRRRS(RRKRTRL((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pytvisitGenExpr�s
cCs;x!|jD]}|j||�q
W|j|j|�dS(N(tqualsRJtexpr(RRKRLtgenfor((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pytvisitGenExprInner�scCsQ|j|j|d�|j|j|�x!|jD]}|j||�q3WdS(Ni(RJtassigntitertifs(RRKRLtif_((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pytvisitGenExprForscCs|j|j|�dS(N(RJttest(RRKRL((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pytvisitGenExprIfsicCs�|s
t�x!|jD]}|j||�qWt|j|j�}|js^t|t�rjd|_n||j	|<|j
||j�|j|j|�|j
||�dS(Ni(tAssertionErrorRORJRDRRRR6R8RIRPRQRRRS(RRKRTR\RURL((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pytvisitLambda	s

cCsJxC|D];}t|�tjkr5|j||�q|j|�qWdS(N(ttypettypest	TupleTypeRPR#(RRLtargsR
((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyRPs
cCs|j|�|j�dS(N(R*R5(RRLRT((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyRS s
cCs�|j|j�x!|jD]}|j||�qWt|j|j�}|jsat|t�rmd|_n|j	dk	r�|jd�n|jd�||j|<|j}|j|_|j|j
|�||_|j||�dS(Nit__doc__R=(RR
tbasesRJR7RRR6R8tdocRRIRRRRS(RRKRTRURLtprev((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyt
visitClass$s

		cCs-|r|j|j�n|j|j�dS(N(RR
R (RRKRLR\((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyt	visitName;scCs_|j|j|d�|j|j|�|j|j|�|jr[|j|j|�ndS(Ni(RJR\tlisttbodytelse_(RRKRL((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pytvisitForCs
	cCsCx<|jD]1\}}|dkr(q
n|j|p7|�q
WdS(Nt*(R9R(RRKRLR
tasname((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyt	visitFromJscCsYxR|jD]G\}}|jd�}|dkr>|| }n|j|pM|�q
WdS(Nt.i����(R9tfindR(RRKRLR
RtR((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pytvisitImportPs

cCs%x|jD]}|j|�q
WdS(N(R9R"(RRKRLR
((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pytvisitGlobalWscCs>x$|jD]}|j||d�q
W|j|j|�dS(s.Propagate assignment flag down to child nodes.

        The Assign node doesn't itself contains the variables being
        assigned to.  Instead, the children in node.nodes are visited
        with the assign flag set to true.  When the names occur in
        those nodes, they are marked as defs.

        Some names that occur in an assignment target are not bound by
        the assignment, e.g. a name occurring inside a slice.  The
        visitor handles these nodes specially; they do not propagate
        the assign flag to their children.
        iN(tnodesRJRY(RRKRLRU((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pytvisitAssign[s
icCs|j|j�dS(N(RR
(RRKRLR\((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pytvisitAssNamelscCs|j|j|d�dS(Ni(RJRY(RRKRLR\((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pytvisitAssAttroscCsA|j|j|d�x$|jD]}|j||d�q WdS(Ni(RJRYtsubs(RRKRLR\RU((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pytvisitSubscriptrscCs^|j|j|d�|jr8|j|j|d�n|jrZ|j|j|d�ndS(Ni(RJRYtlowertupper(RRKRLR\((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyt
visitSlicews
		cCsX|j|j|�t|jtj�rA|j|j|d�n|j|j|�dS(Ni(RJRKR6RtNameRY(RRKRL((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pytvisitAugAssign~scCs�xv|jD]k\}}t|tj�rUt|j�|jkrU|jsRq
qRqUn|j||�|j||�q
W|jr�|j|j|�ndS(N(	ttestsR6RtConstRetvaluet_const_typesRJRq(RRKRLRaRp((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pytvisitIf�s		cCs d|_|j|j|�dS(Ni(RRJR�(RRKRL((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyt
visitYield�s	( RR=RRMtvisitExpressionRVRWR[R`RbRdRPRSRmRnRrRuRxRyR{R|R}RR�R�Rft
StringTypetIntTypet	FloatTypeR�R�R�(((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyRH�s4																
	
cCst|�t|�kS(N(tsorted(tl1tl2((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pytlist_eq�st__main__(t	parseFiletwalkcCsTgg|j�D]}|j�^qD]*}|jd�pG|jd�s&|^q&S(Ns_[Rv(tget_symbolstget_namet
startswith(tsymsts((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyR'�s,itexectoopstskippingi(((6RitcompilerRtcompiler.constsRRRRRRt
compiler.miscRRfR-t
MANGLE_LENRR>R8RARDR7RHR�RR�R�tsymtableR'targvtfiletopentftreadtbuftcloseR�t	mod_namesttreeR�RItnames2R�texitR&R$tvaluesR�tis_namespaceR;R
R�tlRt
get_namespace(((s5/opt/alt/python27/lib64/python2.7/compiler/symbols.pyt<module>sj.�
�		
	
	
!