File "optimizer.cpython-37.opt-1.pyc"
Full Path: /home/attunedd/public_html/byp/izo/con7ext_sym404/rintoar.txt/opt/alt/python37/lib/python3.7/site-packages/jinja2/__pycache__/optimizer.cpython-37.opt-1.pyc
File size: 1.84 KB
MIME-type: text/x-bytecode.python
Charset: 8 bit
B
:`r @ s` d Z ddlZddlmZ ddlmZ ejr6ddlm Z ej
dej
dd d
ZG dd deZdS )
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 )nodeenvironmentreturnc C s t |}ttj|| S )z^The context hint can be used to perform an static optimization
based on the context given.) Optimizertcastr NodeZvisit)r r Z optimizer r
A/opt/alt/python37/lib/python3.7/site-packages/jinja2/optimizer.pyoptimize s r c s@ e Zd ZdddddZejejejejd fddZ Z S ) r zt.Optional[Environment]N)r r c C s
|| _ d S )N)r )selfr r
r
r __init__ s zOptimizer.__init__)r argskwargsr c sd t j|f||}t|tjr`y(tjj||r8|d nd |j| j dS tj
k
r^ Y nX |S )Nr )linenor )super
generic_visit
isinstancer ZExprZConstZfrom_untrustedZas_constr r Z
Impossible)r r r r ) __class__r
r r s
zOptimizer.generic_visit)
__name__
__module____qualname__r r r r
ZAnyr
__classcell__r
r
)r r r s r )
__doc__typingr
r Zvisitorr Z
TYPE_CHECKINGr r r r r r
r
r
r <module> s