|
Server : Apache System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64 User : njnconst ( 1116) PHP Version : 8.4.18 Disable Function : NONE Directory : /lib/python2.7/site-packages/jinja2/ |
Upload File : |
�
-/�_c @ sI d Z d d l m Z d d l m Z d � Z d e f d � � YZ d S( s� 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.
i ( t nodes( t NodeTransformerc C s t | � } | j | � S( s^ The context hint can be used to perform an static optimization
based on the context given.( t Optimizert visit( t nodet environmentt optimizer( ( s2 /tmp/pip-install-sTXtzD/Jinja2/jinja2/optimizer.pyt optimize s R c B s e Z d � Z d � Z RS( c C s
| | _ d S( N( R ( t selfR ( ( s2 /tmp/pip-install-sTXtzD/Jinja2/jinja2/optimizer.pyt __init__ s c O s� t t | � j | | | � } t | t j � r� y? t j j | j | rR | d n d � d | j
d | j �SWq� t j k
r� q� Xn | S( Ni t linenoR (
t superR t
generic_visitt
isinstanceR t Exprt Constt from_untrustedt as_constt NoneR
R t
Impossible( R R t argst kwargs( ( s2 /tmp/pip-install-sTXtzD/Jinja2/jinja2/optimizer.pyR s ( t __name__t
__module__R R ( ( ( s2 /tmp/pip-install-sTXtzD/Jinja2/jinja2/optimizer.pyR s N( t __doc__t R t visitorR R R ( ( ( s2 /tmp/pip-install-sTXtzD/Jinja2/jinja2/optimizer.pyt <module>
s