Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib/python3.7/site-packages/jinja2/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/jinja2/__pycache__/idtracking.cpython-37.pyc

B

^�a�)�@s�ddlZddlmZddlmZdZdZdZdZ	dej
ejejd	d	d
�dd�Z
dejejd	d	d
�dd�ZGdd	�d	�ZGdd�de�ZGdd�de�ZdS)�N�)�nodes)�NodeVisitor�param�resolve�aliasZ	undefined�Symbols)r�parent_symbols�returncCs.t|d�}t|�}x|D]}|�|�qW|S)N)�parent)r�FrameSymbolVisitor�visit)rr	�sym�visitor�node�r�B/opt/alt/python37/lib/python3.7/site-packages/jinja2/idtracking.py�find_symbolss


r)rr	r
cCst|d�}|�|�|S)N)r)r�analyze_node)rr	rrrr�symbols_for_nodes

rc@s*eZdZd#ejdejedd�dd�Zejej	dd�dd�Z
d$eejejeejefed�d	d
�Z
eejej	d�dd
�Zeejed�dd�Zeed�dd�Zdd�dd�Zedd�dd�Zeed�dd�Zedd�dd�Zejddd�dd�Zejeefd�dd �Zejed�d!d"�ZdS)%rN)r�levelr
cCsD|dkr |dkrd}n
|jd}||_||_i|_i|_t�|_dS)Nrr)rr�refs�loads�set�stores)�selfrrrrr�__init__s
zSymbols.__init__)r�kwargsr
cKst|�}|j|f|�dS)N)�RootVisitorr
)rrrrrrrr.szSymbols.analyze_node)�name�loadr
cCs2d|j�d|��}||j|<|dk	r.||j|<|S)NZl_�_)rrr)rrr �identrrr�_define_ref2s


zSymbols._define_ref)�targetr
cCs.||jkr|j|S|jdk	r*|j�|�SdS)N)rr�	find_load)rr$rrrr%;s



zSymbols.find_load)rr
cCs.||jkr|j|S|jdk	r*|j�|�SdS)N)rr�find_ref)rrrrrr&Ds



zSymbols.find_refcCs&|�|�}|dkr"td|�d���|S)NzFTried to resolve a name to a reference that was unknown to the frame (�))r&�AssertionError)rr�rvrrr�refMs

zSymbols.ref)r
cCsJt�tt�|j��}|j�|j�|j�	�|_|j
�	�|_
|j�	�|_|S)N)�t�castr�object�__new__�	__class__�__dict__�updater�copyrr)rr)rrrr2VszSymbols.copycCs`|j�|�||jkr\|jdk	rJ|j�|�}|dk	rJ|j|t|fd�dS|j|tdfd�dS)N)r )r�addrrr&r#�VAR_LOAD_ALIAS�VAR_LOAD_UNDEFINED)rrZ	outer_refrrr�store^s

z
Symbols.storecCs|j�|�|j|tdfd�S)N)r )rr3r#�VAR_LOAD_PARAMETER)rrrrr�declare_parameterpszSymbols.declare_parametercCs$|�|�dkr |j|t|fd�dS)N)r )r&r#�VAR_LOAD_RESOLVE)rrrrrr tszSymbols.load)�branch_symbolsr
c	Cs�i}x<|D]4}x.|jD]$}||jkr&q|�|d�d||<qWq
Wx6|D].}|j�|j�|j�|j�|j�|j�qHWxx|��D]l\}}|t|�kr�q�|�|�}|dk	s�td��|j	dk	r�|j	�|�}|dk	r�t
|f|j|<q�t|f|j|<q�WdS)Nrrzshould not happen)r�getrr1r�items�lenr&r(rr4r9)	rr:r�branchr$rrZbranch_countZouter_targetrrr�
branch_updatexs*




zSymbols.branch_updatecCsJi}|}x<|dk	rDx(t|j�D]}||kr|�|�||<qW|j}q
W|S)N)�sortedrr&r)rr)rrrrr�dump_stores�s

zSymbols.dump_storescCsPt�}|}x@|dk	rJx,|j��D]\}\}}|tkr |�|�q W|j}qW|S)N)rrr<r7r3r)rr)rr$�instrr!rrr�dump_param_targets�s

zSymbols.dump_param_targets)NN)N)�__name__�
__module__�__qualname__r+�Optional�intrr�Node�Anyr�str�Tupler#r%r&r*r2r6r8r �Sequencer?�DictrA�SetrCrrrrrs
			
c@s�eZdZddd�dd�Zejejdd�dd�ZeZ	eZ
eZeZeZ
eZeZejejdd�d	d
�Zejejdd�dd�Zejejdd�d
d�Zdejeejdd�dd�Zejejdd�dd�Zejejejdd�dd�ZdS)rrN)�symbolsr
cCst|�|_dS)N)r�sym_visitor)rrPrrrr�szRootVisitor.__init__)rrr
cKs"x|��D]}|j�|�q
WdS)N)�iter_child_nodesrQr
)rrr�childrrr�
_simple_visit�szRootVisitor._simple_visitcKs x|jD]}|j�|�qWdS)N)�bodyrQr
)rrrrSrrr�visit_AssignBlock�szRootVisitor.visit_AssignBlockcKs&x |jdd�D]}|j�|�qWdS)N)�call)�exclude)rRrQr
)rrrrSrrr�visit_CallBlock�szRootVisitor.visit_CallBlockcKs x|jD]}|j�|�qWdS)N)rUrQr
)rrrrSrrr�visit_OverlayScope�szRootVisitor.visit_OverlayScoperU)r�
for_branchrr
cKs�|dkr"|jj|jdd�|j}nN|dkr2|j}n>|dkrh|jj|jdd�|jdk	rd|j�|j�dStd��|r�x|D]}|j�|�qzWdS)NrUT)�store_as_param�else�testzUnknown for branch)rQr
r$rU�else_r^�RuntimeError)rrr[rr>�itemrrr�	visit_For�s

zRootVisitor.visit_ForcKs<x|jD]}|j�|�qWx|jD]}|j�|�q$WdS)N)�targetsrQr
rU)rrrr$rSrrr�
visit_With�szRootVisitor.visit_With)r�argsrr
cOstdt|�j����dS)NzCannot find symbols for )�NotImplementedError�typerD)rrrerrrr�
generic_visit�szRootVisitor.generic_visit)rU)rDrErFrrrIr+rJrTZvisit_Template�visit_Block�visit_Macro�visit_FilterBlock�visit_Scope�visit_IfZvisit_ScopedEvalContextModifier�AssignBlockrV�	CallBlockrY�OverlayScoperZ�ForrKrb�Withrdrhrrrrr�s rc@sneZdZdZddd�dd�Zd(ejeej	dd�d	d
�Z
ejej	dd�dd
�Zej
ej	dd�dd�Zejej	dd�dd�Zejej	dd�dd�Zejej	dd�dd�Zejej	dd�dd�Zejej	dd�dd�Zejej	dd�dd�Zejej	dd�dd�Zejej	dd�dd�Zejej	dd�d d!�Z ej!ej	dd�d"d#�Z"ej#ej	dd�d$d%�Z$ej%ej	dd�d&d'�Z&dS))rzA visitor for `Frame.inspect`.rN)rPr
cCs
||_dS)N)rP)rrPrrrr�szFrameSymbolVisitor.__init__F)rr\rr
cKsT|s|jdkr|j�|j�n2|jdkr8|j�|j�n|jdkrP|j�|j�dS)z2All assignments to names go through this function.rr6r N)�ctxrPr8rr6r )rrr\rrrr�
visit_Name�s

zFrameSymbolVisitor.visit_Name)rrr
cKs|j�|j�dS)N)rPr r)rrrrrr�visit_NSRef�szFrameSymbolVisitor.visit_NSRefcsn�j|jf���j�tjtjdd����fdd�}||j�}||j�}||j	pTd�}�j�
|||g�dS)Nr)rr
cs4����_}x|D]}�j|f��qW��_|S)N)r2rPr
)rr)Zsubnode)r�original_symbolsrrr�inner_visits

z0FrameSymbolVisitor.visit_If.<locals>.inner_visitr)r
r^rPr+�IterablerrIrUZelif_r_r?)rrrrwZbody_symbolsZelif_symbolsZelse_symbolsr)rrvrrrm�s 	

zFrameSymbolVisitor.visit_IfcKs|j�|j�dS)N)rPr6r)rrrrrrrjszFrameSymbolVisitor.visit_MacrocKs |j|f|�|j�|j�dS)N)rhrPr6r$)rrrrrr�visit_ImportszFrameSymbolVisitor.visit_ImportcKsJ|j|f|�x6|jD],}t|t�r6|j�|d�q|j�|�qWdS)Nr)rh�names�
isinstance�tuplerPr6)rrrrrrr�visit_FromImports

z#FrameSymbolVisitor.visit_FromImportcKs$|j|jf|�|j|jf|�dS)z'Visit assignments in the correct order.N)r
rr$)rrrrrr�visit_AssignszFrameSymbolVisitor.visit_AssigncKs|j|jf|�dS)zqVisiting stops at for blocks.  However the block sequence
        is visited as part of the outer scope.
        N)r
�iter)rrrrrrrb#szFrameSymbolVisitor.visit_ForcKs|j|jf|�dS)N)r
rW)rrrrrrrY)sz"FrameSymbolVisitor.visit_CallBlockcKs|j|jf|�dS)N)r
�filter)rrrrrrrk,sz$FrameSymbolVisitor.visit_FilterBlockcKsx|jD]}|�|�qWdS)N)�valuesr
)rrrr$rrrrd/szFrameSymbolVisitor.visit_WithcKs|j|jf|�dS)zStop visiting at block assigns.N)r
r$)rrrrrrrV3sz$FrameSymbolVisitor.visit_AssignBlockcKsdS)zStop visiting at scopes.Nr)rrrrrrrl7szFrameSymbolVisitor.visit_ScopecKsdS)zStop visiting at blocks.Nr)rrrrrrri:szFrameSymbolVisitor.visit_BlockcKsdS)z!Do not visit into overlay scopes.Nr)rrrrrrrZ=sz%FrameSymbolVisitor.visit_OverlayScope)F)'rDrErF�__doc__rr�Name�boolr+rJrtZNSRefru�IfrmZMacrorj�ImportryZ
FromImportr}�Assignr~rqrbrorYZFilterBlockrkrrrdrnrVZScoperlZBlockrirprZrrrrr�s$		r)N)N)�typingr+�rrrr7r9r4r5rxrIrGrrrrrrrrr�<module>s	:

Hacked By AnonymousFox1.0, Coded By AnonymousFox