| Server IP : 3.96.16.70 / Your IP : 216.73.216.15 Web Server : Apache System : Linux ip-172-31-26-103.ca-central-1.compute.internal 6.1.163-186.299.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Feb 24 16:35:42 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3.9/site-packages/jinja2/__pycache__/ |
Upload File : |
a
�`� � @ s8 d Z ddlmZ ddlmZ dd� ZG dd� de�ZdS ) 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.
� )�nodes)�NodeTransformerc C s t |�}|�| �S )z^The context hint can be used to perform an static optimization
based on the context given.)� OptimizerZvisit)�node�environmentZ optimizer� r �4/usr/lib/python3.9/site-packages/jinja2/optimizer.py�optimize s r c s$ e Zd Zdd� Z� fdd�Z� ZS )r c C s
|| _ d S )N)r )�selfr r r r �__init__ s zOptimizer.__init__c sn t t| �j|g|�R i |��}t|tj�rjz*tjj|�|rB|d nd �|j | j
d�W S tjyh Y n0 |S )N� )�linenor )�superr �
generic_visit�
isinstancer ZExprZConstZfrom_untrustedZas_constr
r Z
Impossible)r
r �args�kwargs�� __class__r r r s �zOptimizer.generic_visit)�__name__�
__module__�__qualname__r r �
__classcell__r r r r r s r N)�__doc__� r Zvisitorr r r r r r r �<module> s