Server IP : 184.154.167.98 / Your IP : 3.133.157.220 Web Server : Apache System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 User : puertode ( 1767) PHP Version : 8.2.26 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /lib/python3.6/site-packages/jinja2/__pycache__/ |
Upload File : |
3 aG�\� � @ s8 d Z ddlmZ ddlmZ dd� ZG dd� de�ZdS ) a[ jinja2.optimizer ~~~~~~~~~~~~~~~~ The jinja optimizer is currently trying to constant fold a few expressions and modify the AST in place so that it should be easier to evaluate it. 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 scoping. The solution would be a second syntax tree that has the scoping rules stored. :copyright: (c) 2017 by the Jinja Team. :license: BSD. � )�nodes)�NodeTransformerc C s t |�}|j| �S )z^The context hint can be used to perform an static optimization based on the context given.)� OptimizerZvisit)�node�environmentZ optimizer� r �/usr/lib/python3.6/optimizer.py�optimize s r c @ sl e Zd Zdd� Zddd�Ze Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z ZZ[dS )r c C s || _ d S )N)r )�selfr r r r �__init__ s zOptimizer.__init__Nc C sB | j |�}ytjj|j|�|j| jd�S tjk r< |S X dS )zDo constant folding.)�linenor N)Z generic_visitr ZConstZfrom_untrustedZas_constr r Z Impossible)r r Zeval_ctxr r r �fold# s zOptimizer.fold)N)�__name__� __module__�__qualname__r r Z visit_AddZ visit_SubZ visit_MulZ visit_DivZvisit_FloorDivZ visit_PowZ visit_ModZ visit_AndZvisit_OrZ visit_PosZ visit_NegZ visit_NotZ visit_CompareZ visit_GetitemZ visit_GetattrZ visit_CallZvisit_FilterZ visit_TestZvisit_CondExprr r r r r s Lr N)�__doc__Zjinja2r Zjinja2.visitorr r r r r r r �<module> s