| Server IP : 146.190.157.162 / Your IP : 216.73.217.6 Web Server : Apache System : Linux ubuntu-s-2vcpu-4gb-amd-sfo3-01-KIT-DIGITAL 6.5.0-44-generic #44-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 7 15:10:09 UTC 2024 x86_64 User : businessweek ( 639) PHP Version : 8.2.10-2ubuntu2.2 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_signal,pcntl_signal_dispatch,pcntl_getpriority,pcntl_setpriority,dl,putenv,parse_ini_file,show_source MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/lib/python3/dist-packages/jinja2/__pycache__/ |
Upload File : |
�
��+br � � � d Z ddlZddlmZ ddlmZ ej rddlm Z dej
dd d
ej
fd�Z G d� d
e� � 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.
� N� )�nodes)�NodeTransformer)�Environment�node�environmentr �returnc � � t |� � }t j t j |� | � � � � S )z^The context hint can be used to perform an static optimization
based on the context given.)� Optimizer�t�castr �Node�visit)r r � optimizers �2/usr/lib/python3/dist-packages/jinja2/optimizer.py�optimizer s1 � � �+�&�&�I��6�%�*�i�o�o�d�3�3�4�4�4� c �` � � e Zd Zd
d�Zdej dej dej dej f� fd �Z� xZ S )r r �t.Optional[Environment]r Nc � � || _ d S )N)r )�selfr s r �__init__zOptimizer.__init__ s � �&����r r �args�kwargsc �4 �� t � � j |g|�R i |��}t |t j � � r_ t j � |� |r|d nd � � |j | j �� � S # t j
$ r Y nw xY w|S )Nr )�linenor )�super�
generic_visit�
isinstancer �Expr�Const�from_untrusted�as_constr r �
Impossible)r r r r � __class__s �r r zOptimizer.generic_visit s� �� � %�u�w�w�$�T�;�D�;�;�;�F�;�;�� �d�E�J�'�'� �
��{�1�1��M�M�T�";�$�q�'�'�t�<�<��;� $� 0� 2� � � ��
�#�
�
�
���
���� �s �AB �B�B)r r r N)
�__name__�
__module__�__qualname__r r r r �Anyr �
__classcell__)r% s @r r r sy �� � � � � �'� '� '� '���J��'(�u��89��� ��� � � � � � � � � r r )
�__doc__�typingr � r �visitorr �
TYPE_CHECKINGr r r r r � r r �<module>r1 s� ��� � � � � � � � � � � � $� $� $� $� $� $��?� )�(�(�(�(�(�(�5�5�:� 5�M� 5�e�j� 5� 5� 5� 5�� � � � �� � � � � r