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__/optimizer.cpython-37.pyc

B

�:�`r�@s`dZddlZddlmZddlmZejr6ddlm	Z	ej
dej
d�d	d
�ZGdd�de�ZdS)
a�The optimizer tries to constant fold expressions and modify the AST
in place so that it should be faster to evaluate.

Because the AST does not contain all the scoping information and the
compiler has to find that out, we cannot do all the optimizations we
want. For example, loop unrolling doesn't work because unrolled loops
would have a different scope. The solution would be a second syntax tree
that stored the scoping rules.
�N�)�nodes)�NodeTransformer)�Environmentr)�node�environment�returncCst|�}t�tj|�|��S)z^The context hint can be used to perform an static optimization
    based on the context given.)�	Optimizer�t�castr�Node�visit)rrZ	optimizer�r�A/opt/alt/python37/lib/python3.7/site-packages/jinja2/optimizer.py�optimizesrcs@eZdZddd�dd�Zejejejejd��fdd�Z�Z	S)	r	zt.Optional[Environment]N)rrcCs
||_dS)N)r)�selfrrrr�__init__szOptimizer.__init__)r�args�kwargsrcsdt�j|f|�|�}t|tj�r`y(tjj|�|r8|dnd�|j|j	d�Stj
k
r^YnX|S)Nr)�linenor)�super�
generic_visit�
isinstancer�ExprZConstZfrom_untrustedZas_constrrZ
Impossible)rrrr)�	__class__rrrs
zOptimizer.generic_visit)
�__name__�
__module__�__qualname__rrrr
�Anyr�
__classcell__rr)rrr	sr	)
�__doc__�typingr
�r�visitorr�
TYPE_CHECKINGrrrrr	rrrr�<module>	s

Hacked By AnonymousFox1.0, Coded By AnonymousFox