ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib64/python3.11/site-packages/jinja2/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/jinja2/__pycache__/compiler.cpython-311.pyc

�

�܋f����dZddlZddlmZddlmZddlmZddl	m
Z
ddlmZ
ddlmZdd	lmZd
dlmZd
dlmZd
d
lmZd
dlmZd
dlmZd
dlmZd
dlmZd
dlmZd
dlmZd
dlmZd
dlm Z d
dl!m"Z"ej#r
ddl$Z%d
dl&m'Z'ej(dej)dej*f���Z+dddddd d!d"d#�Z,d$e+d%e+fd&�Z-d'e.d%ej)d(ej/d)gdffd*�Z0d'e.d%ej)d(ej1d)gdffd+�Z2			dHd.ej3d/d0d1ej4e.d2ej4e.d3ej4ej5d4e6d5e6d%ej4e.fd6�Z7d7ej*d%e6fd8�Z8d9ej9ej:d:ej9e.d%ej;e.fd;�Z<Gd<�d=��Z=Gd>�d)��Z>Gd?�d@e?��Z@GdA�dBe"��ZAGdC�dDe"��ZBGdE�dFeC��ZDGdG�d(e"��ZEdS)Iz0Compiles nodes from the parser into Python code.�N)�contextmanager)�update_wrapper)�StringIO)�chain)�	iskeyword)�escape)�Markup�)�nodes)�TemplateAssertionError)�Symbols)�VAR_LOAD_ALIAS)�VAR_LOAD_PARAMETER)�VAR_LOAD_RESOLVE)�VAR_LOAD_UNDEFINED)�EvalContext)�	Optimizer)�_PassArg)�concat)�NodeVisitor)�Environment�F.)�boundz==z!=�>z>=�<z<=�inznot in)�eq�ne�gt�gteq�lt�lteqr�notin�f�returnc
���dddtjdddtjdtjf
�fd�}t	tjt|�����S)	N�self�
CodeGenerator�node�frame�Frame�kwargsr%c���|j�H|jjs<|j�||j��}||kr|�||��S�|||fi|��S�N)�	optimizer�eval_ctx�volatile�visit)r'r)r*r,�new_noder$s     ��F/opt/cloudlinux/venv/lib64/python3.11/site-packages/jinja2/compiler.py�new_funczoptimizeconst.<locals>.new_func,sk����>�%�e�n�.E�%��~�+�+�D�%�.�A�A�H��4����z�z�(�E�2�2�2��q��t�U�-�-�f�-�-�-�)r�Expr�t�Anyr�castr)r$r5s` r4�
optimizeconstr;+sm���
.��
.�%*�Z�
.�8?�
.�KL�5�
.�	
��
.�
.�
.�
.�
.�
.��!�&��H�-�-�q�1�1�1r6�opr(r+c	�\��tdddtjdtddf�fd���}|S)Nr'r(r)r*r%c���|jjrs�|jjvre|�d��d���|�|j|��|�d��|�|j|��nd|�d��|�|j|��|�d��d���|�|j|��|�d��dS)Nz environment.call_binop(context, �, �(� �))�environment�	sandboxed�intercepted_binops�writer2�left�right�r'r)r*r<s   �r4�visitorz_make_binop.<locals>.visitor<s����
��&�	*��d�&�9�9�9��J�J�B�"�B�B�B�C�C�C��J�J�t�y�%�(�(�(��J�J�t�����J�J�t�z�5�)�)�)�)��J�J�s�O�O�O��J�J�t�y�%�(�(�(��J�J�y�2�y�y�y�!�!�!��J�J�t�z�5�)�)�)��
�
�3�����r6)r;r�BinExprr+�r<rJs` r4�_make_binoprM;sP�����o��U�]��5��T�������]��"�Nr6c	�\��tdddtjdtddf�fd���}|S)Nr'r(r)r*r%c�6��|jjrC�|jjvr5|�d��d���|�|j|��n3|�d�z��|�|j|��|�d��dS)Nzenvironment.call_unop(context, r?r@rB)rCrD�intercepted_unopsrFr2r)rIs   �r4rJz_make_unop.<locals>.visitorTs����
��&�	)��d�&�8�8�8��J�J�A��A�A�A�B�B�B��J�J�t�y�%�(�(�(�(��J�J�s�R�x� � � ��J�J�t�y�%�(�(�(��
�
�3�����r6)r;r�	UnaryExprr+rLs` r4�
_make_unoprRQsR�����o��U�_��U��t�������]���Nr6FTr)rCr�name�filename�stream�
defer_init�	optimizedc���t|tj��std���|�||||||��}|�|��|�|j���SdS)z+Generate the python source for a node tree.z Can't compile non template nodesN)�
isinstancer�Template�	TypeError�code_generator_classr2rU�getvalue)r)rCrSrTrUrVrW�	generators        r4�generater_es|���d�E�N�+�+�<��:�;�;�;��0�0��T�8�V�Z����I��O�O�D����
�~���(�(�*�*�*��4r6�valuec��|�|tus	|turdSt|��ttt
tttthvrdSt|��tttthvrtd�|D����St|��tur+td�|���D����SdS)z)Does the node have a safe representation?NTc3�4K�|]}t|��V��dSr.��
has_safe_repr)�.0�vs  r4�	<genexpr>z has_safe_repr.<locals>.<genexpr>�s*����3�3��=��#�#�3�3�3�3�3�3r6c3�XK�|]%\}}t|��ot|��V��&dSr.rc�re�krfs   r4rgz has_safe_repr.<locals>.<genexpr>�s;����S�S�T�Q��=��#�#�8�
�a�(8�(8�S�S�S�S�S�Sr6F)�NotImplemented�Ellipsis�type�bool�int�float�complex�range�strr	�tuple�list�set�	frozenset�all�dict�items�r`s r4rdrd}s����}���/�/�5�H�3D�3D��t��E�{�{�t�S�%��%��f�E�E�E��t��E�{�{�u�d�C��3�3�3��3�3�U�3�3�3�3�3�3��E�{�{�d����S�S�U�[�[�]�]�S�S�S�S�S�S��5r6r�namesc��t|��}	|D]}|�|���n#t$rYnwxYw|jS)z�Check if the names passed are accessed undeclared.  The return value
    is a set of all the undeclared names from the sequence of names found.
    )�UndeclaredNameVisitorr2�VisitorExit�
undeclared)rr|rJr)s    r4�find_undeclaredr��sh��$�E�*�*�G�
��	 �	 �D��M�M�$�����	 ���
�
�
���
������s�,�
9�9c�L�eZdZdejejejfddfd�ZdS)�MacroRefr)r%Nc�>�||_d|_d|_d|_dS�NF)r)�accesses_caller�accesses_kwargs�accesses_varargs�r'r)s  r4�__init__zMacroRef.__init__�s'����	�$���$��� %����r6)	�__name__�
__module__�__qualname__r8�Unionr�Macro�	CallBlockr��r6r4r�r��sF������&�Q�W�U�[�%�/�%A�B�&�t�&�&�&�&�&�&r6r�c	��eZdZdZ		d
dedejddejeddfd�Zdd�Z	dd
e
ddfd�Zdd�Ze	Z
dS)r+z&Holds compile time information for us.Nr0�parent�levelr%c�@�||_||_|�+t|���|_d|_d|_d|_n?t|j|���|_|j|_|j|_|j|_d|_d|_d|_	d|_
d|_dS)N�r�F)r0r�r
�symbols�require_output_check�buffer�block�toplevel�	rootlevel�
loop_frame�block_frame�
soft_frame)r'r0r�r�s    r4r�zFrame.__init__�s���!��
�����>�"��/�/�/�D�L�).�D�%�,0�D�K�+/�D�J�J�#�6�>��?�?�?�D�L�(.�(C�D�%� �-�D�K���D�J���
�
��� ��� ���
 ����r6c���tjtt�|j����}|j�|j��|j�	��|_|S)z!Create a copy of the current one.)
r8r:r+�object�__new__�	__class__�__dict__�updater��copy�r'�rvs  r4r�z
Frame.copy�sS��
�V�E�6�>�>�$�.�9�9�
:�
:��
����4�=�)�)�)��\�&�&�(�(��
��	r6F�isolatedc�v�|r#t|j|jjdz���St|j|��S)zReturn an inner frame.r
r�)r+r0r�r�)r'r�s  r4�innerzFrame.inner�s<���	F����d�l�.@�1�.D�E�E�E�E��T�]�D�)�)�)r6c�J�|���}d|_d|_|S)a&Return a soft frame.  A soft frame may not be modified as
        standalone thing as it shares the resources with the frame it
        was created of, but it's not a rootlevel frame any longer.

        This is only used to implement if-statements and conditional
        expressions.
        FT)r�r�r�r�s  r4�softz
Frame.soft�s$���Y�Y�[�[�������
��	r6)NN)r%r+�F)r�r�r��__doc__rr8�Optionalror�r�rnr�r��__copy__r�r6r4r+r+�s�������0�0�
'+�!%�	1 �1 ��1 ��
�7�#�1 ��z�#��	1 �

�1 �1 �1 �1 �f����*�*�d�*�w�*�*�*�*������H�H�Hr6c��eZdZdZdS)rz?Exception used by the `UndeclaredNameVisitor` to signal a stop.N�r�r�r�r�r�r6r4rr�s������I�I�I�Ir6rc�h�eZdZdZd	d�Zdejddfd�Zdejddfd�Z	dej
ddfd�ZdS)
�DependencyFinderVisitorz.A visitor that collects filter and test calls.r%Nc�R�t��|_t��|_dSr.)rv�filters�tests�r's r4r�z DependencyFinderVisitor.__init__�s��#&�5�5���!$����
�
�
r6r)c�n�|�|��|j�|j��dSr.)�
generic_visitr��addrSr�s  r4�visit_Filterz$DependencyFinderVisitor.visit_Filters4�����4� � � �������#�#�#�#�#r6c�n�|�|��|j�|j��dSr.)r�r�r�rSr�s  r4�
visit_Testz"DependencyFinderVisitor.visit_Tests2�����4� � � ��
���t�y�!�!�!�!�!r6c��dS)zStop visiting at blocks.Nr�r�s  r4�visit_Blockz#DependencyFinderVisitor.visit_Block����r6�r%N)r�r�r�r�r�r�Filterr��Testr��Blockr�r�r6r4r�r��s�������8�8�'�'�'�'�$���$�$�$�$�$�$�"�u�z�"�d�"�"�"�"�'���'��'�'�'�'�'�'r6r�c�l�eZdZdZdejeddfd�Zdej	ddfd�Z
dejddfd�ZdS)	r~z�A visitor that checks if a name is accessed without being
    declared.  This is different from the frame visitor as it will
    not stop at closure frames.
    r|r%Nc�T�t|��|_t��|_dSr.)rvr|r�)r'r|s  r4r�zUndeclaredNameVisitor.__init__s����Z�Z��
�&)�e�e����r6r)c���|jdkrM|j|jvr?|j�|j��|j|jkrt���dS|j�|j��dS)N�load)�ctxrSr|r�r�r�discardr�s  r4�
visit_Namez UndeclaredNameVisitor.visit_Namesv���8�v���$�)�t�z�"9�"9��O����	�*�*�*���$�*�,�,�!�m�m�#�-�,�
�J���t�y�)�)�)�)�)r6c��dS)zStop visiting a blocks.Nr�r�s  r4r�z!UndeclaredNameVisitor.visit_Block!r�r6)
r�r�r�r�r8�Iterablersr�r�Namer�r�r�r�r6r4r~r~s���������
,�a�j��o�,�$�,�,�,�,�*�u�z�*�d�*�*�*�*�&���&��&�&�&�&�&�&r6r~c��eZdZdZdS)�CompilerExitz�Raised if the compiler encountered a situation where it just
    doesn't make sense to further process the code.  Any block that
    raises such an exception is not further processed.
    Nr�r�r6r4r�r�%s���������r6r�c�
�eZdZU			d�dddejedejedejejd	ed
eddfd�Ze	defd
���Z
dededdfd�Zdefd�Z
deddfd�Z	d�dededdfd�Zd�d�Zd�deddfd�Zd�dedejejddfd�Zdeddfd�Z	d�dededejejddfd�Zd ejejdeddfd!�Zd"eddfd#�Z	d�d"edejejd%eddfd&�Zd�dejejd%eddfd'�Z	d�dejejejej fded(ejej!eej"fddfd)�Z#d ejejddfd*�Z$deddfd+�Z%d�ded,eddfd-�Z&d�d0ed1edefd2�Z'dedefd3�Z(dejej)ej*fdedej+ee,ffd4�Z-d5e,deddfd6�Z.dejdefd7�Z/dedefd8�Z0d�d9�Z1deddfd:�Z2d�d;�Z3d<eddfd=�Z4d<eddfd>�Z5d�d?�Z6defd@�Z7defdA�Z8dedefdB�Z9d<edefdC�Z:d�dD�Z;deddfdE�Z<	d�dej=dejeddfdF�Z>dej?deddfdG�Z@dejAdeddfdH�ZBdejCdeddfdI�ZDdejejEejFfdeddfdJ�ZGdejEdeddfdK�ZHdejFdeddfdL�ZIdejJdeddfdM�ZKdejLdeddfdN�ZMdej)deddfdO�ZNdej*deddfdP�ZOdejPdeddfdQ�ZQdejRdeddfdR�ZSdejTdeddfdS�ZUGdT�dUejV��ZWeXdVej"dej"fdW���ZYdZZejeWe[dX<deWfdY�Z\dZejej"defd[�Z]dej^ded\eWdefd]�Z_dej^ded\eWddfd^�Z`dej^ded\eWddfd_�Zadejbdeddfd`�Zcdejddeddfda�Zedejfdeddfdb�Zgdejhdeddfdc�Zidejjdeddfdd�Zkdejldeddfde�Zmdejndeddfdf�Zodej+deddfdg�Zpdejqdeddfdh�Zrdejsdeddfdi�Zteudj��Zveudk��Zweudl��Zxeudm��Zyeudn��Zzeudo��Z{eudp��Z|eudq��Z}eudr��Z~edj��Z�edk��Z�eds��Z�e�dej�deddfdt���Z�e�dej�deddfdu���Z�dej�deddfdv�Z�e�dej�deddfdw���Z�e�dej�deddfdx���Z�dej�deddfdy�Z�e�dejejej fdedzedej�dfd{���Z�e�dejdeddfd|���Z�e�dej deddfd}���Z�e�dej�deddfd~���Z�e�	d�dejdededdfd����Z�dej�deddfd��Z�dej�deddfd��Z�dej�deddfd��Z�dej�deddfd��Z�dej�deddfd��Z�dej�deddfd��Z�dej�deddfd��Z�dej�deddfd��Z�dej�deddfd��Z�dej�deddfd��Z�dej�deddfd��Z�dej�deddfd��Z�dej�deddfd��Z�dej�deddfd��Z�dej�deddfd��Z�dS)�r(NFTrCrrSrTrUrVrWr%c��|�t��}||_||_||_||_d|_||_d|_|rt|��|_i|_	i|_
d|_d|_d|_
i|_i|_g|_d|_d|_d|_d|_d|_d|_g|_g|_dg|_dS)NFrr
T�context)rrCrSrTrU�created_block_contextrVr/r�import_aliases�blocks�extends_so_far�has_known_extends�code_linenor�r��
debug_info�_write_debug_info�
_new_lines�
_last_line�_first_write�_last_identifier�_indentation�
_assign_stack�_param_def_block�_context_reference_stack)r'rCrSrTrUrVrWs       r4r�zCodeGenerator.__init__-s���>��Z�Z�F�&�����	� ��
����%*��"�$���04����	4�&�{�3�3�D�N�13���13��� ���
"'������(*��
�)+���68���26���������!���!"������24���57���*3���%�%�%r6c��|jduSr.)r/r�s r4rWzCodeGenerator.optimizedvs���~�T�)�)r6�msg�linenozte.NoReturnc�:�t|||j|j���)z*Fail with a :exc:`TemplateAssertionError`.)rrSrT)r'r�r�s   r4�failzCodeGenerator.fail|s��$�S�&�$�)�T�]�K�K�Kr6c�6�|xjdz
c_d|j��S)zGet a new unique identifier.r
�t_)r�r�s r4�temporary_identifierz"CodeGenerator.temporary_identifier�s'������"���+�D�)�+�+�+r6r*c�r�|���|_|�|j�d���dS)z7Enable buffering for the frame from that point onwards.z = []N)r�r��	writeline�r'r*s  r4r�zCodeGenerator.buffer�s8���0�0�2�2������%�,�-�-�-�.�.�.�.�.r6�force_unescapedc�&�|s�|jjr�|�d��|���|�d|j�d���|���|�d��|���|�d|j�d���|���dS|jjr |�d|j�d���dS|�d|j�d���dS)z(Return the buffer contents of the frame.zif context.eval_ctx.autoescape:zreturn Markup(concat(�))�else:zreturn concat(rBN)r0r1r��indentr��outdent�
autoescape)r'r*r�s   r4�return_buffer_contentsz$CodeGenerator.return_buffer_contents�s���
	��~�&�
����@�A�A�A����
�
�
����G�u�|�G�G�G�H�H�H����������w�'�'�'����
�
�
����?���?�?�?�@�@�@�����������*�
����G�u�|�G�G�G�H�H�H������7���7�7�7�8�8�8�8�8r6c�&�|xjdz
c_dS)zIndent by one.r
N�r�r�s r4r�zCodeGenerator.indent�s�����Q�����r6r
�stepc�&�|xj|zc_dS)zOutdent by step.Nr�)r'r�s  r4r�zCodeGenerator.outdent�s�����T�!����r6r)c��|j�|�d|��dS|�|j�d�|��dS)z%Yield or write into the frame buffer.N�yield �.append()r�r�)r'r*r)s   r4�start_writezCodeGenerator.start_write�sI���<���N�N�8�T�*�*�*�*�*��N�N�e�l�4�4�4�d�;�;�;�;�;r6c�B�|j�|�d��dSdS)z1End the writing process started by `start_write`.NrB)r�rFr�s  r4�	end_writezCodeGenerator.end_write�s%���<�#��J�J�s�O�O�O�O�O�$�#r6�sc��|�||��|�|��|�|��dS)z4Simple shortcut for start_write + write + end_write.N)rrFr)r'rr*r)s    r4�simple_writezCodeGenerator.simple_write�sA��	
�����%�%�%��
�
�1�
�
�
����u�����r6rc��	|�d��|D]}|�||���dS#t$rYdSwxYw)z�Visit a list of nodes as block in a frame.  If the current frame
        is no buffer a dummy ``if 0: yield None`` is written automatically.
        �passN)r�r2r�)r'rr*r)s    r4�
blockvisitzCodeGenerator.blockvisit�sk��	��N�N�6�"�"�"��
(�
(���
�
�4��'�'�'�'�
(�
(���	�	�	��D�D�	���s�04�
A�A�xc��|jr�|jsk|j�d|jz��|xj|jz
c_|j�-|j�|j|jf��d|_d|_|j�d|jz��d|_|j�|��dS)z&Write a string into the output stream.�
NFz    r)	r�r�rUrFr�r�r��appendr�)r'r	s  r4rFzCodeGenerator.write�s����?�		 ��$�
2���!�!�$���"8�9�9�9�� � �D�O�3� � ��)�5��O�*�*�D�,B�D�DT�+U�V�V�V�-1�D�*� %�D���K���f�t�'8�8�9�9�9��D�O�����!�����r6r�extrac�\�|�||��|�|��dS)z!Combination of newline and write.N)�newlinerF)r'r	r)r
s    r4r�zCodeGenerator.writeline�s+��	
���T�5�!�!�!��
�
�1�
�
�
�
�
r6c��t|jd|z��|_|�*|j|jkr|j|_|j|_dSdSdS)z/Add one or more newlines before the next write.r
N)�maxr�r�r�r�)r'r)r
s   r4rzCodeGenerator.newline�sR���d�o�q�5�y�9�9�������t�� >� >�%)�[�D�"�"�k�D�O�O�O��� >� >r6�extra_kwargsc���td�td�|jD��|pd��D����}|jD]-}|�d��|�||���.|sl|jD]-}|�d��|�||���.|�5|���D] \}}|�d|�d|�����!|jr0|�d��|�|j|��|�r%|j�|�d��n|�d	��|jD]O}|�|j	�d
���|�|j
|��|�d���P|�5|���D] \}}|�|�d
|�d����!|j�G|�d��|�|j|��|�d��dS|�d
��dS|j�2|�d��|�|j|��dSdS)a+Writes a function call to the stream for the current node.
        A leading comma is added automatically.  The extra keyword
        arguments may not include python keywords otherwise a syntax
        error could occur.  The extra keyword arguments should be given
        as python dict.
        c3�dK�|]+}ttjt|����V��,dSr.)�is_python_keywordr8r:rs)rerjs  r4rgz*CodeGenerator.signature.<locals>.<genexpr>�sH����
�
��
�a�f�S�!�n�n�-�-�
�
�
�
�
�
r6c3�$K�|]}|jV��dSr.)�key�rer	s  r4rgz*CodeGenerator.signature.<locals>.<genexpr>�s$����7�7�a�A�E�7�7�7�7�7�7r6r�r?N�=z, *z
, **dict({z, **{�: z}, **rB�}z, **)�anyrr,�argsrFr2rz�dyn_args�
dyn_kwargsrr`)	r'r)r*r�kwarg_workaround�arg�kwargrr`s	         r4�	signaturezCodeGenerator.signature�s����
�
��7�7�4�;�7�7�7��9K��L�L�
�
�
�
�
��
�9�	#�	#�C��J�J�t�����J�J�s�E�"�"�"�"��	3���
)�
)���
�
�4� � � ��
�
�5�%�(�(�(�(��'�".�"4�"4�"6�"6�3�3�J�C���J�J�1�C�1�1�%�1�1�2�2�2�2��=�	-��J�J�u�����J�J�t�}�e�,�,�,��	/���*��
�
�<�(�(�(�(��
�
�7�#�#�#���
!�
!���
�
�e�i�-�-�-�.�.�.��
�
�5�;��.�.�.��
�
�4� � � � ��'�".�"4�"4�"6�"6�6�6�J�C���J�J�#�4�4�5�4�4�4�5�5�5�5���*��
�
�7�#�#�#��
�
�4�?�E�2�2�2��
�
�3�������
�
�3������
�_�
(��J�J�v�����J�J�t���.�.�.�.�.�)�
(r6c
�>�t��}|D]}|�|���|j|jdf|j|jdffD�]T\}}}t	|��D�]<}||vr|���||<|�d��|���|�||�d|�d|�d���|���|�d��|���|�d��|�d	||�d
���|���|�d|dd
��d|�d���|���|�����>��VdS)a�Find all filter and test names used in the template and
        assign them to variables in the compiled namespace. Checking
        that the names are registered with the environment is done when
        compiling the Filter and Test nodes. If the node is in an If or
        CondExpr node, the check is done at runtime instead.

        .. versionchanged:: 3.0
            Filters and tests in If and CondExpr nodes are checked at
            runtime instead of compile time.
        r�r��try:z = environment.�[�]zexcept KeyError:z
@internalcode�def z
(*unused):zraise TemplateRuntimeError("No N���� named z	 found."))	r�r2r�r��sortedr�r�r�r�)r'rrJr)�id_mapr|�
dependencyrSs        r4�pull_dependencieszCodeGenerator.pull_dependenciess���*�+�+���	 �	 �D��M�M�$�����*.�,����)S��J��M��V
�*
�	�	�%�F�E�:�
�u�
�
�
�
���v�%�%�#'�#<�#<�#>�#>�F�4�L����v�&�&�&����
�
�
����&��,�U�U�z�U�U�D�U�U�U�V�V�V����������1�2�2�2����
�
�
�����/�/�/����>�f�T�l�>�>�>�?�?�?����
�
�
����0�j��"��o�0�0�"�0�0�0�����������������)
�	�	r6c	���g}|jj���D]�\}\}}|tkr�|tkr1|�|�d|����d|�d����P|tkr|�|�d|�����v|tkr|�	|����td���|r-|�d�|���d���dSdS)N� = r@rBzunknown load instruction�
 = missing)r��loadsrzrrr��get_resolve_funcrrr�NotImplementedError�join)r'r*�undefs�target�action�params      r4�enter_framezCodeGenerator.enter_frameEs$����',�}�':�'@�'@�'B�'B�
	F�
	F�#�F�O�V�U��+�+�+���+�+�+����&�Q�Q�T�-B�-B�-D�-D�Q�Q�u�Q�Q�Q�R�R�R�R��>�)�)����&�4�4�U�4�4�5�5�5�5��-�-�-��
�
�f�%�%�%�%�)�*D�E�E�E��	>��N�N�e�j�j��0�0�<�<�<�=�=�=�=�=�	>�	>r6�with_python_scopec��|sUg}|jjD]}|�|���|r/|�d�|���d���dSdSdS)Nr0r1)r�r2rr�r5)r'r*r;r6r7s     r4�leave_framezCodeGenerator.leave_frameUs��� �	B��F��-�-�
&�
&���
�
�f�%�%�%�%��
B����%�*�*�V�"4�"4�@�@�@�A�A�A�A�A�	B�	B�
B�
Br6�async ��async_value�
sync_valuec�"�|jjr|n|Sr.)rC�is_async)r'r@rAs   r4�choose_asynczCodeGenerator.choose_async]s��"�.�7�G�{�{�Z�Gr6c�4�|����d|��S)Nr()rD)r'rSs  r4�funczCodeGenerator.func`s"���#�#�%�%�1�1�4�1�1�1r6c
�P�|���}|j�|��t|��}d}t	��}g}t|j��D]g\}}|jdkr|}|jdvr|�|j��|�	|j�
|j�����ht|jd��}	d|	vr�|�O	|j
|t|j��z
nX#t$r|�d|j��Yn1wxYw|�	|j�d����d|_d|	vr8d|vr4|�	|j�d����d|_d|	vr8d|vr4|�	|j�d����d|_d	|_|j�|��|�|�d
���dd�|���d
�|��|���|�|��|�|��|�|��t|j��D�]\}}|j�
|j��}
|�d|
�d���|���	|j
|t|j��z
}|�|
�d���|�||��n8#t$r+|�|
�d|j�d|j�d���YnwxYw|�|
��|� ����|�!��|�"|j|��|�#|d���|�$|d���|� ��||fS)z/Dump the function def of a macro or call block.N�caller)r,�varargs)rHr,rIzhWhen defining macros or call blocks the special "caller" argument must be omitted or be given a default.Tr,rIF�macror@r?�):�if � is missing:r0z = undefined("parameter z was not provided", name=rB)r��r;)%r�r��analyze_noder�rv�	enumeraterrSr�r�refr��body�defaults�len�
IndexErrorr�r��declare_parameterr�r�r�r�r�rFr5r�r�r:�push_parameter_definitionsr2�mark_parameter_storedr��pop_parameter_definitionsrr�r=)r'r)r*�	macro_ref�explicit_caller�skip_special_paramsr�idxr!r�rQ�defaults            r4�
macro_bodyzCodeGenerator.macro_bodycsM�����
�
��
�
�"�"�4�(�(�(��T�N�N�	���!�e�e����!�$�)�,�,�	5�	5�H�C���x�8�#�#�"%���x�0�0�0�#�'�'���1�1�1��K�K��
�)�)�#�(�3�3�4�4�4�4�$�T�Y�0O�P�P�
��z�!�!��*���M�/�C��	�N�N�"B�C�C�C��!�����I�I�1���	������������E�M�;�;�H�E�E�F�F�F�(,�I�%��z�!�!�h�6I�&I�&I��K�K��
�7�7��A�A�B�B�B�(,�I�%��
�"�"�y�8K�'K�'K��K�K��
�7�7�	�B�B�C�C�C�)-�I�&�&+��"�
�
�"�"�4�(�(�(����$�)�)�G�,�,�B�B�t�y�y����B�B�B�D�I�I�I����
�
�
����E������������'�'��.�.�.�!�$�)�,�,�	�	�H�C���-�#�#�C�H�-�-�C��N�N�2��2�2�2�3�3�3��K�K�M�M�M�	
+��-��c�$�)�n�n�(<�=�����#�{�{�{�+�+�+��
�
�7�E�*�*�*�*���
�
�
�����+�+�C�H�+�+� �X�+�+�+������
����
�&�&�s�+�+�+��L�L�N�N�N�N��&�&�(�(�(�����	�5�)�)�)��#�#�E�4�#�@�@�@�����$��7�7�7��������i��s$�("D�%D3�2D3�?"M�2N�NrZc
�0�d�d�|jjD����}t|jdd��}t	|jj��dkr|dz
}|�d|�d|�d	|j�d|j�d|j�d
���dS)z<Dump the macro definition for the def created by macro_body.r?c3�>K�|]}t|j��V��dSr.)�reprrSrs  r4rgz*CodeGenerator.macro_def.<locals>.<genexpr>�s*����H�H�q�d�1�6�l�l�H�H�H�H�H�Hr6rSNr
�,zMacro(environment, macro, z, (z), z, context.eval_ctx.autoescape))	r5r)r�getattrrTrFr�r�r�)r'rZr*�	arg_tuplerSs     r4�	macro_defzCodeGenerator.macro_def�s����I�I�H�H�I�N�4G�H�H�H�H�H�	��y�~�v�t�4�4���y�~�"�#�#�q�(�(����I��
�
�
L��
L�
L�I�
L�
L��)�
L�
L�/8�/I�
L�
L��)�
L�
L�
L�	
�	
�	
�	
�	
r6c�@�d|j��}|j�|�d|j��}|S)z.Return a human readable position for the node.zline N� in )r�rS)r'r)r�s   r4�positionzCodeGenerator.position�s3��
"�T�[�
"�
"���9� ��)�)�D�I�)�)�B��	r6c��d�d�|j������D����}d|�d�S)Nr?c3�*K�|]\}}|�d|��V��dS�rNr�)rerSr7s   r4rgz3CodeGenerator.dump_local_context.<locals>.<genexpr>�sH����
�
���f��!�!��!�!�
�
�
�
�
�
r6�{r)r5r��dump_storesrz)r'r*�items_kvs   r4�dump_local_contextz CodeGenerator.dump_local_context�s^���9�9�
�
� %�
� 9� 9� ;� ;� A� A� C� C�
�
�
�
�
��!�H� � � � r6c��|�d��|�d��|�d��|�d��dS)z�Writes a common preamble that is used by root and block functions.
        Primarily this sets up common local helpers and enforces a generator
        through a dead branch.
        z$resolve = context.resolve_or_missingz!undefined = environment.undefinedzcond_expr_undefined = Undefinedzif 0: yield NoneN�r�r�s r4�
write_commonszCodeGenerator.write_commons�sX��
	
���=�>�>�>����:�;�;�;�	
���8�9�9�9����)�*�*�*�*�*r6c�h�|j�|j�����dS)aQPushes all parameter targets from the given frame into a local
        stack that permits tracking of yet to be assigned parameters.  In
        particular this enables the optimization from `visit_Name` to skip
        undefined expressions for parameters in macros as macros can reference
        otherwise unbound parameters.
        N)r�rr��dump_param_targetsr�s  r4rWz(CodeGenerator.push_parameter_definitions�s/��	
��$�$�U�]�%E�%E�%G�%G�H�H�H�H�Hr6c�8�|j���dS)z+Pops the current parameter definitions set.N)r��popr�s r4rYz'CodeGenerator.pop_parameter_definitions�s����!�!�#�#�#�#�#r6r7c�X�|jr"|jd�|��dSdS)z�Marks a parameter in the current parameter definitions as stored.
        This will skip the enforced undefined checks.
        r)N)r�r��r'r7s  r4rXz#CodeGenerator.mark_parameter_stored�s;��� �	6��!�"�%�-�-�f�5�5�5�5�5�	6�	6r6c�:�|j�|��dSr.)r�rrys  r4�push_context_referencez$CodeGenerator.push_context_reference�s���%�,�,�V�4�4�4�4�4r6c�8�|j���dSr.)r�rwr�s r4�pop_context_referencez#CodeGenerator.pop_context_reference�s���%�)�)�+�+�+�+�+r6c��|jdS)Nr)�r�r�s r4�get_context_refzCodeGenerator.get_context_ref�s���,�R�0�0r6c�6�|jd}|dkrdS|�d�S)Nr)r��resolvez.resolverrys  r4r3zCodeGenerator.get_resolve_func�s.���.�r�2���Y����9��"�"�"�"r6c�\�|����d|�|���d�S)Nz	.derived(rB)r�rpr�s  r4�derive_contextzCodeGenerator.derive_context�s3���&�&�(�(�T�T�4�3J�3J�5�3Q�3Q�T�T�T�Tr6c�2�|jsdS||jdvS)z4Checks if a given target is an undeclared parameter.Fr))r�rys  r4�parameter_is_undeclaredz%CodeGenerator.parameter_is_undeclareds%���$�	��5���.�r�2�2�2r6c�R�|j�t����dS)z+Pushes a new layer for assignment tracking.N)r�rrvr�s r4�push_assign_trackingz"CodeGenerator.push_assign_trackings#����!�!�#�%�%�(�(�(�(�(r6c�z�|j���}|js|js|jr|sdSd�|D��}t|��dkr�t
t|����}|j�	|��}|jr|�
d|�d|����dS|jr|�
d|�d|����dS|�
d|�d|����n�|jr|�
d��n2|jr|�
d	��n|�
d
��t|��D]P\}}|r|�d��|j�	|��}|�|�d|�����Q|�d
��|js�|js{|r{t|��dkr!|�
d|d�d���dSd�
tt|����}|�
d|�d���dSdSdSdS)zoPops the topmost level for assignment tracking and updates the
        context variables if necessary.
        Nc�.�g|]}|dd�dk�|��S)Nr
�_r�rs  r4�
<listcomp>z5CodeGenerator.pop_assign_tracking.<locals>.<listcomp>s%��8�8�8�a�1�R�a�R�5�C�<�<��<�<�<r6r
z_loop_vars[�] = z_block_vars[�
context.vars[z_loop_vars.update({z_block_vars.update({�context.vars.update({r?r�})�context.exported_vars.add(rrBzcontext.exported_vars.update((r�)r�rwr�r�r�rT�next�iterr�rQr�rPrFr5�maprb)r'r*�vars�public_namesrSrQr]�	names_strs        r4�pop_assign_trackingz!CodeGenerator.pop_assign_trackings����!�%�%�'�'���!�	��$�	��N�	��		�
�F�8�8�4�8�8�8���t�9�9��>�>���T�
�
�#�#�D��-�#�#�D�)�)�C���
����>�T�>�>��>�>�?�?�?���� �
����?�d�?�?�#�?�?�@�@�@����N�N�<�4�<�<�s�<�<�=�=�=�=���
8����4�5�5�5�5��"�
8����5�6�6�6�6����6�7�7�7�&�t�_�_�
/�
/�	��T��%��J�J�t�$�$�$��m�'�'��-�-���
�
�d�-�-��-�-�.�.�.�.��J�J�t����� �	O��)9�	O�l�	O��<� � �A�%�%����P�L��O�P�P�P�Q�Q�Q�Q�Q� �I�I�c�$��&=�&=�>�>�	����M�	�M�M�M�N�N�N�N�N�	O�	O�	O�	O�	O�	Or6c	�
�|�
Jd���t|j|j��}ddlm}m}|jjrt||z��}nt|��}|�d��|�dd�	|��z��|j
rdnd}|�tj
��du}|�tj��D]C}	|	j|jvr$|�d	|	j�d
�|	j��|	|j|	j<�D|�tj��D]�}
|
j|jvr||
j}|���x|j|<}d|vr8|�dd��\}
}|�d|
�d
|�d|�����q|�d|�d|������|�d|j����|�|�d���d|�d�d���|���|���t7|��}dt9|jd��vr2|j�d��}|�|�d���|j� |��dx|_!|_"|o|j#|_$|r|�d��|�%|��|�&|j��|�'|j|��|�(|d���|�)��|r�|j#s)|���|�d��|���|jjs|�d��nR|�d��|���|�d��|�)��|�)d|j#z��|j�*��D�]�\}}	|�|�d|z���d|�d�|	d��|���|���t7|��}d|_+t9|	jd ��}d|vr2|j�d��}|�|�d���d!|vr8|j�d!��}|�|�d"|�d#|�d$���|j� |	��||_,|�d%��|�%|��|�&|	j��|�'|	j|��|�(|d���|�)�����d�	d&�|jD����}|�d'|�d(�d���d)�	d*�|j-D����}|�d+|����dS),Nzno root frame allowedr
)�exported�async_exportedz%from __future__ import generator_stopzfrom jinja2.runtime import r?r?z, environment=environmentzblock z defined twice�.zfrom z import z as zimport zname = �rootz(context, missing=missingrK)r
r'r�z = TemplateReference(context)Tzparent_template = NonerN�if parent_template is not None:z4yield from parent_template.root_render_func(context)z=async for event in parent_template.root_render_func(context):zyield event�block_)r'�superr�z = context.super(z, block_rBz_block_vars = {}c3�$K�|]}|�d|��V��dS)z: block_Nr�rs  r4rgz/CodeGenerator.visit_Template.<locals>.<genexpr>�s0����!K�!K�!�Q�"5�"5�!�"5�"5�!K�!K�!K�!K�!K�!Kr6z
blocks = {r�&c3�*K�|]\}}|�d|��V��dS)rNr�ris   r4rgz/CodeGenerator.visit_Template.<locals>.<genexpr>�s0����G�G�t�q�!�1�
�
�q�
�
�G�G�G�G�G�Gr6z
debug_info = ).rrCrS�runtimer�r�rCr+r�r5rV�findr�Extends�find_allr�r�r�r��ImportedName�
importnamer�r��rsplitrFr�rsr+r�rRr�rVrOr�r�r�r�r:r.rr=r�rzr�r�r�)r'r)r*r0r�r��exported_names�envenv�have_extendsr��import_�imp�alias�module�objrQrSr�r��
blocks_kv_str�debug_kv_strs                     r4�visit_TemplatezCodeGenerator.visit_Template9s����}�}�5�}�}�}��t�/���;�;��5�5�5�5�5�5�5�5���$�	.�#�H�~�$=�>�>�N�N�#�H�-�-�N����>�?�?�?����4�t�y�y��7P�7P�P�Q�Q�Q���G���,G���y�y���/�/�t�;���]�]�5�;�/�/�	,�	,�E��z�T�[�(�(��	�	�?�5�:�?�?�?���N�N�N�&+�D�K��
�#�#��}�}�U�%7�8�8�	?�	?�G��!��)<�<�<��(��37�3L�3L�3N�3N�N��#�C�(�5��#�:�:�"%�*�*�S�!�"4�"4�K�F�C��N�N�#K�6�#K�#K�3�#K�#K�E�#K�#K�L�L�L�L��N�N�#=�S�#=�#=�e�#=�#=�>�>�>��	
���.���.�.�/�/�/�	
����y�y�� � �E�E�6�E�E�E�Q�	�	
�	
�	
�	
���
�
�
��������h�����_�T�Y�	�:�:�:�:��-�1�1�&�9�9�C��N�N�c�@�@�@�A�A�A�
�
�"�"�4�(�(�(�+/�/�����%1�%P�$�:P�6P��"��	5��N�N�3�4�4�4�����������t�y�)�)�)�����	�5�)�)�)�����$��7�7�7��������	;��)�
B����
�
�
����@�A�A�A��K�K�M�M�M��#�,�
����U�V�V�V�V����S�������
�
�
����}�-�-�-��������L�L��$�"8�8�9�:�:�:� �;�,�,�.�.�	�	�K�D�%��N�N��9�9�X��_�-�-�R�R��R�R�R���
�
�
�

�K�K�M�M�M���� � � � ��/�/�K�&*�K�#�(���5F�G�G�J���#�#�!�)�;�;�F�C�C�����#�D�D�D�E�E�E��*�$�$�!�)�;�;�G�D�D�����#�O�O��O�O��O�O�O�P�P�P���,�,�U�3�3�3� $�K���N�N�-�.�.�.����[�)�)�)��"�"�5�:�.�.�.��O�O�E�J��4�4�4����[�D��A�A�A��L�L�N�N�N�N��	�	�!K�!K�t�{�!K�!K�!K�K�K�
����6�]�6�6�6�a��@�@�@��x�x�G�G�t��G�G�G�G�G�����7�|�7�7�8�8�8�8�8r6c�V�d}|jrB|jrdS|jdkr.|�d��|���|dz
}|jr|�|��}n|���}|jrf|�d|j	�d�|��|���|�d|j	�d�|��|�
��|jjs*|j
�#|�d	|j	�d
|�d�|��nt|�|����d|j	�d
|�d
�|��|���|�d|��|�
��|�
|��dS)z.Call a block and register it for the template.rN�if parent_template is None:r
zif len(context.blocks[z]) <= 1:z+raise TemplateRuntimeError("Required block z not found")zyield from context.blocks[z][0](rBzfor event in context.blocks[rK�event)r�r�r�r�r��scopedr�r��requiredrSr�rCrCr�rDr)r'r)r*r�r�s     r4r�zCodeGenerator.visit_Block�s������>�	��%�
����"�Q�&�&����<�=�=�=����
�
�
���
���;�	-��)�)�%�0�0�G�G��*�*�,�,�G��=�	��N�N�I�D�I�I�I�I�4�P�P�P��K�K�M�M�M��N�N�W�d�i�W�W�W��
�
�
�
�L�L�N�N�N���(�	�U�\�-A��N�N�I�T�Y�I�I�w�I�I�I�4�
�
�
�
�
�N�N��$�$�&�&�A�A�#'�9�A�A�5<�A�A�A��
�
�
�

�K�K�M�M�M����g�u�-�-�-��L�L�N�N�N����U�����r6c��|js|�d|j��|jdkrn|js)|�d��|���|�d��|jrt���|���|�d|��|�	|j
|��|�d|j�d���|�d��|���|�d	��|���|j
rd
|_|xjdz
c_dS)
zCalls the extender.z,cannot use extend from a non top-level scoperr�z5raise TemplateRuntimeError("extended multiple times")z+parent_template = environment.get_template(r?rBz9for name, parent_block in parent_template.blocks.items():z8context.blocks.setdefault(name, []).append(parent_block)Tr
N)r�r�r�r�r�r�r�r�r�r2�templaterFrSr��r'r)r*s   r4�
visit_ExtendszCodeGenerator.visit_Extends�sS���~�	S��I�I�D�d�k�R�R�R�
���"�"��)�
����@�A�A�A����
�
�
��N�N�R�S�S�S��%�
�"�n�n�$����������D�d�K�K�K��
�
�4�=�%�(�(�(��
�
�&��	�&�&�&�'�'�'����R�S�S�S����
�
�
����Q�R�R�R�������
�?�	*�%)�D�"�	
���q� ����r6c�*�|jr)|�d��|���d}t|jt
j��rKt|jjt��rd}nVt|jjttf��rd}n-t|jt
jt
jf��rd}|�d|�d�|��|�
|j|��|�d|j�d���|jr�|���|�d	��|���|�d
��|���|�d��|���d}|jrA|�|����d
|�|���d���n9|jjr|�d��n|�d��d}|s>|���|�d|��|���|jr|���dSdS)zHandles includes.r%�get_or_select_template�get_template�select_templateztemplate = environment.r@r?rBzexcept TemplateNotFound:rr�FzUfor event in template.root_render_func(template.new_context(context.get_all(), True, z)):zGfor event in (await template._get_default_module_async())._body_stream:z6yield from template._get_default_module()._body_streamTr�N)�ignore_missingr�r�rYr�r�Constr`rsrtru�Tuple�Listr2rFrSr��with_contextrDrprCrCr)r'r)r*�	func_name�skip_event_yields     r4�
visit_IncludezCodeGenerator.visit_Includes�����	��N�N�6�"�"�"��K�K�M�M�M�,�	��d�m�U�[�1�1�	*��$�-�-�s�3�3�
.�*�	�	��D�M�/�%���?�?�
.�-�	��
��
���U�Z�'@�
A�
A�	*�)�I����=��=�=�=�t�D�D�D��
�
�4�=�%�(�(�(��
�
�&��	�&�&�&�'�'�'���	��L�L�N�N�N��N�N�5�6�6�6��K�K�M�M�M��N�N�6�"�"�"��L�L�N�N�N��N�N�7�#�#�#��K�K�M�M�M� ����
	$��N�N��$�$�&�&�8�8��+�+�E�2�2�8�8�8�
�
�
�
�
�
�
&�	$��N�N�!�
�
�
�
�

�N�N�S�T�T�T�#���	��K�K�M�M�M����g�u�-�-�-��L�L�N�N�N���	��L�L�N�N�N�N�N�	�	r6c���|�|�d���d���|�|j|��|�d|j�d���|jrHd|�d����}|�|�d|�|���d���dS|�d	|�d���d
���dS)N�await zenvironment.get_template(r?z).�make_module�_asyncz(context.get_all(), True, rB�_get_default_modulez	(context))rFrDr2r�rSr�rp)r'r)r*�f_names    r4�_import_commonzCodeGenerator._import_common9s��	
�
�
�d�'�'��1�1�L�L�L�M�M�M��
�
�4�=�%�(�(�(��
�
�'��	�'�'�'�(�(�(���	U�@�4�#4�#4�X�#>�#>�@�@�F��J�J��V�V�T�5L�5L�U�5S�5S�V�V�V�
�
�
�
�
�
�J�J�S�T�->�->�x�-H�-H�S�S�S�T�T�T�T�Tr6c�n�|�|j�|j���d�|��|jr|�d|j�d���|�||��|jr:|j�d��s"|�d|j�d���dSdSdS)zVisit regular imports.r0r�r�r��context.exported_vars.discard(rBN)r�r�rQr7r�rFr��
startswithr�s   r4�visit_ImportzCodeGenerator.visit_ImportHs������%�-�+�+�D�K�8�8�=�=�=�t�D�D�D��>�	<��J�J�:�t�{�:�:�:�;�;�;����D�%�(�(�(��>�	N�$�+�"8�"8��"=�"=�	N��N�N�L�D�K�L�L�L�M�M�M�M�M�	N�	N�	N�	Nr6c	�0��|�|��|�d��|�|���g}g}|jD�]C}t	|t
��r|\}}n|}|��j�|���d|�d���|�d�j�|���d���|�	��d|�
|���d|��}|��j�|���d|�d	|�d
���|����jr?|�
|��|�d��s|�
|����E|r�t|��dkr<|d
}|�d|�d�j�|������n:d��fd�|D����}|�d|�d���|rwt|��dkr!|�d|d
�d
���dSd�t#t$|����}	|�d|	�d���dSdS)zVisit named imports.zincluded_template = z = getattr(included_template, z
, missing)rLrMz9the template {included_template.__name__!r} (imported on z%) does not export the requested name z = undefined(fz, name=rBr�r
rr�r�r?c3�V�K�|]#}|�d�j�|����V��$dSrl)r�rQ)rerSr*s  �r4rgz1CodeGenerator.visit_FromImport.<locals>.<genexpr>xsR�����%�%�?C�t�:�:���!2�!2�4�!8�!8�:�:�%�%�%�%�%�%r6r�r�r�z)context.exported_vars.difference_update((r�N)rrFr�r|rYrtr�r�rQr�rir�r�rr�rTr5r�rb)
r'r)r*�	var_names�discarded_namesrSr��message�names_kvr�s
  `       r4�visit_FromImportzCodeGenerator.visit_FromImportSs������T�����
�
�)�*�*�*����D�%�(�(�(��	����J�	2�	2�D��$��&�&�
�"���e�e����N�N��=�$�$�U�+�+�B�B�/3�B�B�B�
�
�
�
�N�N�G���!2�!2�5�!9�!9�G�G�G�H�H�H��K�K�M�M�M�@�!%���t�!4�!4�@�@�7;�@�@�
�

�N�N��=�$�$�U�+�+�V�V�7�V�V�T�V�V�V�
�
�
�
�L�L�N�N�N��~�
2�� � ��'�'�'��'�'��,�,�2�#�*�*�5�1�1�1���	G��9�~�~��"�"� ��|�����T�t�T�T�5�=�;L�;L�T�;R�;R�T�T�U�U�U�U��9�9�%�%�%�%�GP�%�%�%�������E��E�E�E�F�F�F��	��?�#�#�q�(�(����W��PQ�@R�W�W�W�X�X�X�X�X� �I�I�c�$��&@�&@�A�A�	����M�	�M�M�M������	�	r6c���|���}d|_|���}|���}|jp[dt|�d���d��vp5td�|�tj��D����}d}|r|j	�
d��}|j	�|d���|jr|j	�|d	���|j
�r�|���}|j	�|d
���|�|�|���d�|j
��|���|�|��|�|�dd
����|�|j|��|�d��|�|�dd����|�d��|���|�d|j
��|�|j
|��|�d��|���|�d��|�|j|��|�d��|�|d���|jra|�|�d���d�|��|���|�|��|j|_|r|�|�d���|�tj��D]3}	|	jdkr&|	jdkr|�d|	j���4|jr,|���}
|�|
�d���|�|�dd
��|��|�|j|��|r0|�d|�d|�d���d���n|�d��|j
r|�|�d���|jr|�d��na|jj r|s|�d ��|�|j!|��|jj r|s|�d!��|j
r|�d!��|jr|�d"��n|�|rd#nd��|���|�|��|�d$��|�"|j#|��|jr|�|
�d%���|���|�||jo|j���|jr�|�d|
�d���|���|�|��|�"|j|��|�|��|���|jr�|�$|��|���|�%||��|�|�d&���d'���|jj r|�d ��|�|j!|��|jj r|�d!��|�d(��|�&|��|j'r,|j'd)�(|j	j)��dSdS)*NT�loop)rR)�only)r�c3�$K�|]}|jV��dSr.)r�)rer�s  r4rgz*CodeGenerator.visit_For.<locals>.<genexpr>�s$����H�H�E�5�<�H�H�H�H�H�Hr6rR)�
for_branch�else�testz(fiter):z
async for zfor rhzauto_aiter(fiter)�fiter�:rLr��rNz%(reciter, loop_render_func, depth=0):r1�storez8Can't assign to special loop variable in for-loop targetz = 1r?�AsynczLoopContext(r@�reciterzauto_aiter(rBz&, undefined, loop_render_func, depth):z
, undefined):z_loop_vars = {}z = 0r�zloop(z, loop)r))*r�r��	recursiver��iter_child_nodesrr�rr�r�rVrO�else_r�r�r�rFr�r:rDr2r7rFr�r=r�r�r�rSr�r�rCrCr�rrRr�rrr��difference_update�stores)r'r)r*r��
test_frame�
else_frame�
extended_loop�loop_ref�loop_filter_funcrS�iteration_indicators           r4�	visit_ForzCodeGenerator.visit_For�s����[�[�]�]�
� $�
���[�[�]�]�
��[�[�]�]�
�
�N�
I���t�4�4�)�4�D�D�i�P�P�Q�
I��H�H�T�]�]�5�;�-G�-G�H�H�H�H�H�		����	D�!�)�;�;�F�C�C�H���'�'���'�@�@�@��:�	E���+�+�D�V�+�D�D�D��9�	A�#�8�8�:�:����+�+�D�V�+�D�D�D��N�N�d�i�i�(8�9�9�C�C�C�T�Y�O�O�O��K�K�M�M�M����Z�(�(�(��N�N�4�,�,�\�6�B�B�C�C�C��J�J�t�{�J�/�/�/��J�J�v�����J�J�t�(�(�)<�g�F�F�G�G�G��J�J�s�O�O�O��K�K�M�M�M��N�N�5�$�)�,�,�,��J�J�t�y�*�-�-�-��J�J�s�O�O�O��K�K�M�M�M��N�N�8�$�$�$��J�J�t�{�J�/�/�/��L�L��O�O�O����Z�4��@�@�@�
�>�	2��N�N��9�9�V�$�$�K�K�K�T�
�
�
�
�K�K�M�M�M��K�K�
�#�#�#�!+� 1�J���	4��N�N�h�2�2�2�3�3�3��M�M�%�*�-�-�	�	�D��x�7�"�"�t�y�F�':�':��	�	�N��K�����
�:�	9�"&�";�";�"=�"=���N�N�1�7�7�7�8�8�8����t�(�(��v�>�>��E�E�E��
�
�4�;�
�+�+�+��	��J�J�R�H�R�R�$�*;�*;�G�*D�*D�R�R�R�S�S�S�S��J�J�v�����9�	/��J�J�*�-�-�-�.�.�.��>�	 ��J�J�y�!�!�!�!���(�
*��
*��
�
�=�)�)�)��J�J�t�y�%�(�(�(���(�
 ��
 ��
�
�3�����9�	��J�J�s�O�O�O��>�	B��J�J�?�@�@�@�@��J�J�-�@���S�A�A�A����
�
�
�����$�$�$����(�)�)�)�����	�:�.�.�.��:�	9��N�N�1�7�7�7�8�8�8�����������$�.�*K���^�	�	
�	
�	
��:�	��N�N�7�!4�7�7�7�8�8�8��K�K�M�M�M����Z�(�(�(��O�O�D�J�
�3�3�3����Z�(�(�(��L�L�N�N�N��>�	"��'�'�
�3�3�3��L�L�N�N�N����U�D�)�)�)��J�J�$�+�+�H�5�5�<�<�<�=�=�=���(�
*��
�
�=�)�)�)��J�J�t�y�%�(�(�(���(�
 ��
�
�3�����J�J�y�!�!�!��N�N�5�!�!�!���	P���r�"�4�4�Z�5G�5N�O�O�O�O�O�	P�	Pr6c�(�|���}|�d|��|�|j|��|�d��|���|�|j|��|���|j	D]�}|�d|��|�|j|��|�d��|���|�|j|��|�����|j
rZ|�d��|���|�|j
|��|���dSdS)NrLr�zelif r�)r�r�r2r�rFr�rrRr��elif_r�)r'r)r*�if_framer�s     r4�visit_IfzCodeGenerator.visit_IfsN���:�:�<�<�����u�d�#�#�#��
�
�4�9�h�'�'�'��
�
�3�������
�
�
�����	�8�,�,�,��������Z�	�	�E��N�N�7�E�*�*�*��J�J�u�z�8�,�,�,��J�J�s�O�O�O��K�K�M�M�M��O�O�E�J��1�1�1��L�L�N�N�N�N��:�	��N�N�7�#�#�#��K�K�M�M�M��O�O�D�J��1�1�1��L�L�N�N�N�N�N�		�	r6c��|�||��\}}|���|jrV|j�d��s|�d|j�d���|�d|j�d���|�|j�|j���d���|�	||��dS)Nr�r�rBr�r�r0)
r_rr�rSr�rFr�r�rQrf)r'r)r*�macro_framerZs     r4�visit_MacrozCodeGenerator.visit_Macro%s���!%����u�!=�!=���Y��������>�	>��9�'�'��,�,�
H��
�
�F��	�F�F�F�G�G�G��N�N�<�4�9�<�<�<�=�=�=��
�
�e�m�'�'��	�2�2�7�7�7�8�8�8����y�+�.�.�.�.�.r6c��|�||��\}}|�d��|�||��|�||��|�|j|d���|�|��dS)Nz	caller = T)�forward_caller)r_r�rfr�
visit_Call�callr)r'r)r*�
call_framerZs     r4�visit_CallBlockzCodeGenerator.visit_CallBlock/s��� $����e� <� <��
�I����{�#�#�#����y�*�-�-�-������%�%�%�����	�5���>�>�>����u�����r6c��|���}|j�|��|�|��|�|��|�|j|��|�||��|�|j	|��|�
|��|�|��dSr.)r�r�rOr:r�rrRrr��filterrr=)r'r)r*�filter_frames    r4�visit_FilterBlockzCodeGenerator.visit_FilterBlock7s����{�{�}�}����)�)�$�/�/�/�����&�&�&����L�!�!�!�����	�<�0�0�0������%�%�%����$�+�|�4�4�4����u��������&�&�&�&�&r6c���|���}|j�|��|�|��t	|j|j��D]Z\}}|���|�||��|�	d��|�||���[|�
|j|��|�|��dS�Nr0)
r�r�rOr:�zip�targets�valuesrr2rFrrRr=)r'r)r*�
with_framer7�exprs      r4�
visit_WithzCodeGenerator.visit_WithBs����[�[�]�]�
���'�'��-�-�-�����$�$�$����d�k�:�:�	$�	$�L�F�D��L�L�N�N�N��J�J�v�z�*�*�*��J�J�u�����J�J�t�U�#�#�#�#�����	�:�.�.�.�����$�$�$�$�$r6c�f�|�|��|�|j|��dSr.)rr2r)r�s   r4�visit_ExprStmtzCodeGenerator.visit_ExprStmtNs0�����T�����
�
�4�9�e�$�$�$�$�$r6c�j�eZdZUejejdefed<ejeed<dS)�CodeGenerator._FinalizeInfo.�const�srcN)r�r�r�r8r��Callablers�__annotations__r�r6r4�
_FinalizeInforRsB��������z�!�*�S�#�X�.�/�/�/�/�
�Z��_�����r6rr`c� �t|��S)z�The default finalize function if the environment isn't
        configured with one. Or, if the environment has one, this is
        called on that function's output for constants.
        )rsr{s r4�_default_finalizezCodeGenerator._default_finalizeVs���5�z�z�r6�	_finalizec�������j��jS�jx}�d}�jjr�d}�jj�tjdtjdtjdi�t	j�����}d}|� dtj
dtj
f��fd�}n-|�|�d	�}|dkr dtj
dtj
f���fd
�}��||���_�jS)a�Build the finalize function to be used on constants and at
        runtime. Cached so it's only created once for all output nodes.

        Returns a ``namedtuple`` with the following attributes:

        ``const``
            A function to finalize constant data at compile time.

        ``src``
            Source code to output around nodes to be evaluated at
            runtime.
        Nzenvironment.finalize(r��context.eval_ctxrCr`r%c�,����|����Sr.r�)r`r^�env_finalizes ��r4�finalizez.CodeGenerator._make_finalize.<locals>.finalize�s���"�7�<�<��#6�#6�7�7�7r6r?c�8�����j|����Sr.)rC)r`r^rr's ���r4rz.CodeGenerator._make_finalize.<locals>.finalize�s"���&�w�|�|�D�4D�e�'L�'L�M�M�Mr6)rrrCrrr��eval_context�get�from_objr8r9r)r'rr�pass_argr^rs`   @@r4�_make_finalizezCodeGenerator._make_finalize`sX������>�%��>�!�"�3�3��7�����$�	N�)�C��+�4�L�� �)��%�'9��$�m���c��!�,�/�/���	
��H���8�A�E�8�a�e�8�8�8�8�8�8�8�8��*�h�*�*�*���}�,�,�N���N�!�%�N�N�N�N�N�N�N�N��+�+�H�c�:�:����~�r6�groupc�:�tt|����S)z�Given a group of constant values converted from ``Output``
        child nodes, produce a string to write to the template module
        source.
        )rbr)r'r&s  r4�_output_const_reprz CodeGenerator._output_const_repr�s��
�F�5�M�M�"�"�"r6rc���|�|j��}|jjrt|��}t	|t
j��rt|��S|�|��S)aCTry to optimize a child of an ``Output`` node by trying to
        convert it to constant, finalized data at compile time.

        If :exc:`Impossible` is raised, the node is not constant and
        will be evaluated at runtime. Any other exception will also be
        evaluated at runtime for easier debugging.
        )	�as_constr0r�rrYr�TemplateDatarsr)r'r)r*rrs     r4�_output_child_to_constz$CodeGenerator._output_child_to_const�sd���
�
�e�n�-�-���>�$�	"��5�M�M�E��d�E�.�/�/�	��u�:�:���~�~�e�$�$�$r6c��|jjr|�d��n7|jjr|�d��n|�d��|j�|�|j��dSdS)zXOutput extra source code before visiting a child of an
        ``Output`` node.
        z1(escape if context.eval_ctx.autoescape else str)(zescape(zstr(N)r0r1rFr�r�r'r)r*rs    r4�_output_child_prezCodeGenerator._output_child_pre�s����>�"�	��J�J�J�K�K�K�K�
�^�
&�	��J�J�y�!�!�!�!��J�J�v�����<�#��J�J�x�|�$�$�$�$�$�$�#r6c�l�|�d��|j�|�d��dSdS)zWOutput extra source code after visiting a child of an
        ``Output`` node.
        rBN)rFrr.s    r4�_output_child_postz CodeGenerator._output_child_post�s6��	
�
�
�3�����<�#��J�J�s�O�O�O�O�O�$�#r6c���|jr2|jrdS|�d��|���|���}g}|jD]�}	|js-t|t
j��stj	���|�
|||��}n1#t
j	tf$r|�|��Y�|wxYw|r7t|dt��r|d�|����|�|g����|j�bt|��dkr|�|j�d���n|�|j�d���|���|D]�}t|t��rN|�|��}|j�|�d|z���L|�|dz���e|j�|�d|��n|�|��|�|||��|�||��|�|||��|j�|�d����|j�>|���|�t|��dkrdnd	��|jr|���dSdS)
Nr�r)r
r�z	.extend((r�rcrBr�)r�r�r�r�r%rrrYr+�
Impossibler,�	Exceptionrrur�rTr(rr/r2r1rFr�)	r'r)r*rrR�childr�item�vals	         r4�visit_OutputzCodeGenerator.visit_Output�s���%�	��%�
����N�N�8�9�9�9��K�K�M�M�M��&�&�(�(��;=��
�Z�	%�	%�E�
��N�-�"�%��);�<�<�
-� �*�,�,�,��3�3�E�5�(�K�K�����$�i�0�
�
�
����E�"�"�"���
�����
%�
�4��8�T�2�2�
%��R�����&�&�&�&����U�G�$�$�$�$��<�#��4�y�y�A�~�~����%�,�8�8�8�9�9�9�9����%�,�9�9�9�:�:�:��K�K�M�M�M��	$�	$�D��$��%�%�
$��-�-�d�3�3���<�'��N�N�8�c�>�2�2�2�2��N�N�3��9�-�-�-�-��<�'��N�N�8�T�2�2�2�2��L�L��&�&�&��&�&�t�U�H�=�=�=��
�
�4��'�'�'��'�'��e�X�>�>�>��<�+��J�J�s�O�O�O���<�#��L�L�N�N�N��N�N�#�d�)�)�q�.�.�3�3�d�;�;�;��%�	��L�L�N�N�N�N�N�	�	s�AB&�&+C�Cc��|���|�|��|�|j|��|�d��|�|j|��|�|��dSr)r�rr2r7rFr)r�r�s   r4�visit_AssignzCodeGenerator.visit_Assigns~���!�!�#�#�#����T�����
�
�4�;��&�&�&��
�
�5�����
�
�4�9�e�$�$�$�� � ��'�'�'�'�'r6c��|���|���}d|_|j�|��|�|��|�|��|�|j|��|�	|��|�
|j|��|�d��|j
�|�|j
|��n|�d|j�d���|�d��|�|��|�|��dS)NFz9 = (Markup if context.eval_ctx.autoescape else identity)(�concat(rB)r�r�r�r�rOr:r�rrRrr2r7rFrr�r�r=)r'r)r*r�s    r4�visit_AssignBlockzCodeGenerator.visit_AssignBlocks:���!�!�#�#�#��k�k�m�m��,1��(���(�(��.�.�.�����%�%�%����K� � � �����	�;�/�/�/����T�����
�
�4�;��&�&�&��
�
�N�O�O�O��;�"����d�k�;�7�7�7�7��J�J�6��!3�6�6�6�7�7�7��
�
�3����� � ��'�'�'�����%�%�%�%�%r6c	���|jdkrA|js|js|jr,|jr%|jd�|j��|j�|j��}|jdkrh|j�	|��}|�&|dtkr|�|��r&|�d|j�d|�d|�d���dS|�|��dS)	Nr�r)r�rz(undefined(name=z) if z is missing else rB)
r�r�r�r�r�r�rSr�rQ�	find_loadrr�rF)r'r)r*rQr�s     r4r�zCodeGenerator.visit_Name6s���8�w����N��#�.��27�2C���!�
6��"�2�&�*�*�4�9�5�5�5��m����	�*�*��
�8�v����=�*�*�3�/�/�D�� ���G�1�1�1��4�4�S�9�9�2��
�
�U�t�y�U�U��U�U�s�U�U�U�������
�
�3�����r6c�0�|j�|j��}|�d|�d���|���|�d��|���|�|�d|j�d���dS)Nzif not isinstance(z
, Namespace):zMraise TemplateRuntimeError("cannot assign attribute on non-namespace object")r&r')r�rQrSr�r�r��attr)r'r)r*rQs    r4�visit_NSRefzCodeGenerator.visit_NSRefOs����m����	�*�*�����>�C�>�>�>�?�?�?����
�
�
����
B�	
�	
�	
�	
���������#�.�.��	�.�.�.�/�/�/�/�/r6c���|�|j��}t|t��r$|�t|����dS|�t
|����dSr.)r*r0rYrprFrsrb)r'r)r*r7s    r4�visit_ConstzCodeGenerator.visit_Const]sc���m�m�E�N�+�+���c�5�!�!�	"��J�J�s�3�x�x� � � � � ��J�J�t�C�y�y�!�!�!�!�!r6c���	|�t|�|j������dS#tj$r"|�d|j�d���YdSwxYw�Nz6(Markup if context.eval_ctx.autoescape else identity)(rB)rFrbr*r0rr3�datar�s   r4�visit_TemplateDataz CodeGenerator.visit_TemplateDatads���	��J�J�t�D�M�M�%�.�9�9�:�:�;�;�;�;�;����	�	�	��J�J�W���W�W�W�
�
�
�
�
�
�	���s�:>�-A/�.A/c��|�d��d}t|j��D]2\}}|r|�d��|�||���3|�|dkrdnd��dS)Nr@r)r?rz,)rB�rFrPrzr2�r'r)r*r]r6s     r4�visit_TuplezCodeGenerator.visit_Tuplels����
�
�3������"�4�:�.�.�	$�	$�I�C���
!��
�
�4� � � ��J�J�t�U�#�#�#�#��
�
�3�!�8�8�4�4��-�-�-�-�-r6c���|�d��t|j��D]2\}}|r|�d��|�||���3|�d��dS)Nr&r?r'rJrKs     r4�
visit_ListzCodeGenerator.visit_Listusr���
�
�3����"�4�:�.�.�	$�	$�I�C���
!��
�
�4� � � ��J�J�t�U�#�#�#�#��
�
�3�����r6c�R�|�d��t|j��D]g\}}|r|�d��|�|j|��|�d��|�|j|���h|�d��dS)Nrmr?rr)rFrPrzr2rr`rKs     r4�
visit_DictzCodeGenerator.visit_Dict}s����
�
�3����"�4�:�.�.�	*�	*�I�C���
!��
�
�4� � � ��J�J�t�x��'�'�'��J�J�t�����J�J�t�z�5�)�)�)�)��
�
�3�����r6�+�-�*�/z//z**�%�and�orznot c�
�|jjrd}n|jjrd}nd}|�|�d���|jD]-}|�||��|�d���.|�d��dS)Nz8(markup_join if context.eval_ctx.volatile else str_join)�markup_join�str_joinz((r?r�)r0r1r�rFrr2)r'r)r*r�r!s     r4�visit_ConcatzCodeGenerator.visit_Concat�s����>�"�	#�R�I�I�
�^�
&�	#�%�I�I�"�I��
�
�i�#�#�#�$�$�$��:�	�	�C��J�J�s�E�"�"�"��J�J�t������
�
�4�����r6c���|�d��|�|j|��|jD]}|�||���|�d��dS)Nr@rB)rFr2r
�opsrIs    r4�
visit_ComparezCodeGenerator.visit_Compare�sb���
�
�3�����
�
�4�9�e�$�$�$��(�	"�	"�B��J�J�r�5�!�!�!�!��
�
�3�����r6c��|�dt|j�d���|�|j|��dS)NrA)rF�	operatorsr<r2r
r�s   r4�
visit_OperandzCodeGenerator.visit_Operand�sC���
�
�,�y���)�,�,�,�-�-�-��
�
�4�9�e�$�$�$�$�$r6c�*�|jjr|�d��|�d��|�|j|��|�d|j�d���|jjr|�d��dSdS)N�(await auto_await(zenvironment.getattr(r?rBr�)rCrCrFr2r)rAr�s   r4�
visit_GetattrzCodeGenerator.visit_Getattr�s�����$�	-��J�J�+�,�,�,��
�
�)�*�*�*��
�
�4�9�e�$�$�$��
�
�&��	�&�&�&�'�'�'���$�	��J�J�t������	�	r6c�z�t|jtj��rb|�|j|��|�d��|�|j|��|�d��dS|jjr|�d��|�d��|�|j|��|�d��|�|j|��|�d��|jjr|�d��dSdS)Nr&r'rczenvironment.getitem(r?rBr�)	rYr!r�Slicer2r)rFrCrCr�s   r4�
visit_GetitemzCodeGenerator.visit_Getitem�s���d�h���,�,�	!��J�J�t�y�%�(�(�(��J�J�s�O�O�O��J�J�t�x��'�'�'��J�J�s�O�O�O�O�O���(�
1��
�
�/�0�0�0��J�J�-�.�.�.��J�J�t�y�%�(�(�(��J�J�t�����J�J�t�x��'�'�'��J�J�s�O�O�O���(�
!��
�
�4� � � � � �
!�
!r6c�*�|j�|�|j|��|�d��|j�|�|j|��|j�2|�d��|�|j|��dSdS)Nr�)�startr2rF�stopr�r�s   r4�visit_SlicezCodeGenerator.visit_Slice�s����:�!��J�J�t�z�5�)�)�)��
�
�3�����9� ��J�J�t�y�%�(�(�(��9� ��J�J�s�O�O�O��J�J�t�y�%�(�(�(�(�(�!� r6�	is_filterc#�\K�|jjr|�d��|rM|�|j|j�d���|jj�|j��}nL|�|j|j�d���|jj�|j��}|�4|js-|rdnd}|�d|�d|j�d�|j	��tjdtjd	tjd
i�tj
|����}|�|�|�d���dV�|�||��|�d��|jjr|�d��dSdS)
N�await auto_await(r@rr�zNo r*r�r�rrCr?rB)rCrCrFr�rSr"r�r�r�r�rr�r!r#r#)r'r)r*rlrF�	type_namer$s       r4�_filter_test_commonz!CodeGenerator._filter_test_common�s�������$�	,��J�J�*�+�+�+��	9��J�J�$�,�t�y�1�4�4�4�5�5�5��#�+�/�/��	�:�:�D�D��J�J�$�*�T�Y�/�2�2�2�3�3�3��#�)�-�-�d�i�8�8�D�
�<�� 0�<�$-�9���6�I��I�I�<�I�<�<�d�i�<�<�<�d�k�J�J�J�
��i��!�#5�� �-�
��#���d�#�#�
�
�		����J�J�(����'�'�'�	�������t�U�#�#�#��
�
�3������$�	��J�J�s�O�O�O�O�O�	�	r6c��|�||d��5|j�|�|j|��n||jjr'|�d|j�d|j�d���nI|jjr|�d|j�d���n|�d|j�d���ddd��dS#1swxYwYdS)NTz(Markup(concat(z.)) if context.eval_ctx.autoescape else concat(r�zMarkup(concat(r<rB)rpr)r2r0r1rFr�r�r�s   r4r�zCodeGenerator.visit_FiltersH��
�
%�
%�d�E�4�
8�
8�
	6�
	6��y�$��
�
�4�9�e�,�,�,�,���(�
6��
�
�T�e�l�T�T�CH�<�T�T�T�������*�
6��
�
�<�E�L�<�<�<�=�=�=�=��
�
�4�U�\�4�4�4�5�5�5�
	6�
	6�
	6�
	6�
	6�
	6�
	6�
	6�
	6�
	6�
	6�
	6����
	6�
	6�
	6�
	6�
	6�
	6s�B C�C	�C	c��|�||d��5|�|j|��ddd��dS#1swxYwYdSr�)rpr2r)r�s   r4r�zCodeGenerator.visit_Tests���
�
%�
%�d�E�5�
9�
9�	)�	)��J�J�t�y�%�(�(�(�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)����	)�	)�	)�	)�	)�	)s�A�A�Ac�l���������d���fd�}��d�����j�����d�����j�����d��|����d��dS)Nr%c����j����j���dS��d������d���dS)Nz1cond_expr_undefined("the inline if-expression on z6 evaluated to false and no else section was defined."))�expr2r2rFri)r*r)r's���r4�write_expr2z1CodeGenerator.visit_CondExpr.<locals>.write_expr2si����z�%��
�
�4�:�u�-�-�-����J�J�+��M�M�$�'�'�+�+�+�
�
�
�
�
r6r@z if z else rBr�)r�rFr2�expr1r�)r'r)r*rvs``` r4�visit_CondExprzCodeGenerator.visit_CondExprs�������
�
����		�		�		�		�		�		�		�		�	
�
�
�3�����
�
�4�:�u�%�%�%��
�
�6�����
�
�4�9�e�$�$�$��
�
�8������
�
�
��
�
�3�����r6r�c��|jjr|�d��|jjr|�d��n|�d��|�|j|��|rddind}|jrddini}|jrddini}|r|j|fi|��n|s|r
t|fi|��}|�
|||��|�d��|jjr|�d��dSdS)Nrnzenvironment.call(context, z
context.call(rH�
_loop_vars�_block_varsrB)rCrCrFrDr2r)r�r�r�ryr#)r'r)r*r�r�loop_kwargs�block_kwargss       r4r�zCodeGenerator.visit_Call0sN����$�	,��J�J�*�+�+�+���%�	(��J�J�3�4�4�4�4��J�J��'�'�'��
�
�4�9�e�$�$�$�/=�G��(�+�+�4��6;�6F�N�|�\�2�2�B��9>�9J�R�
�}�5�5�PR���	=��L���<�<�|�<�<�<�<�
�	=�L�	=���<�<�|�<�<�L����t�U�L�1�1�1��
�
�3������$�	��J�J�s�O�O�O�O�O�	�	r6c�v�|�|jdz��|�|j|��dS)Nr)rFrr2r`r�s   r4�
visit_KeywordzCodeGenerator.visit_KeywordGs6���
�
�4�8�c�>�"�"�"��
�
�4�:�u�%�%�%�%�%r6c��|�d��|�|j|��|�d��dS)NzMarkup(rB�rFr2r
r�s   r4�visit_MarkSafezCodeGenerator.visit_MarkSafeMs=���
�
�9�����
�
�4�9�e�$�$�$��
�
�3�����r6c��|�d��|�|j|��|�d��dSrFr�r�s   r4�visit_MarkSafeIfAutoescapez(CodeGenerator.visit_MarkSafeIfAutoescapeRs@��	
�
�
�K�L�L�L��
�
�4�9�e�$�$�$��
�
�3�����r6c�@�|�d|jz��dS)Nzenvironment.�rFrSr�s   r4�visit_EnvironmentAttributez(CodeGenerator.visit_EnvironmentAttributeYs#��	
�
�
�>�D�I�-�.�.�.�.�.r6c�P�|�d|j�d|j����dS)Nzenvironment.extensions[z].)rF�
identifierrSr�s   r4�visit_ExtensionAttributez&CodeGenerator.visit_ExtensionAttribute^s1��	
�
�
�M�T�_�M�M�$�)�M�M�N�N�N�N�Nr6c�P�|�|j|j��dSr.)rFr�r�r�s   r4�visit_ImportedNamez CodeGenerator.visit_ImportedNamecs$���
�
�4�&�t��7�8�8�8�8�8r6c�:�|�|j��dSr.r�r�s   r4�visit_InternalNamez CodeGenerator.visit_InternalNamefs���
�
�4�9�����r6c�0�|�d��dS)Nr�)rFr�s   r4�visit_ContextReferencez$CodeGenerator.visit_ContextReferenceis��	
�
�
�9�����r6c�V�|�|�|����dSr.)rFr�r�s   r4�visit_DerivedContextReferencez+CodeGenerator.visit_DerivedContextReferencens*��	
�
�
�4�&�&�u�-�-�.�.�.�.�.r6c�2�|�d|��dS)N�continuerrr�s   r4�visit_ContinuezCodeGenerator.visit_Continuess�����z�4�(�(�(�(�(r6c�2�|�d|��dS)N�breakrrr�s   r4�visit_BreakzCodeGenerator.visit_Breakvs�����w��%�%�%�%�%r6c���|���}|j�|��|�|��|�|j|��|�|��dSr.)r�r�rOr:rrRr=)r'r)r*�scope_frames    r4�visit_ScopezCodeGenerator.visit_Scopeysj���k�k�m�m����(�(��.�.�.�����%�%�%�����	�;�/�/�/�����%�%�%�%�%r6c�*�|���}|�|�d|�|������|�|�d���|�|j|��|�|��|�d���}|j�|��|�	|��|�
|j|��|�|��|�
��dS)Nr0z.vars = T)r�)r�r�r�r2r�r{r�r�rOr:rrRr=r})r'r)r*r�r�s     r4�visit_OverlayScopez CodeGenerator.visit_OverlayScope�s���'�'�)�)�����#�>�>�$�"5�"5�e�"<�"<�>�>�?�?�?����#�'�'�'�(�(�(��
�
�4�<��'�'�'��#�#�C�(�(�(��k�k�4�k�0�0����(�(��.�.�.�����%�%�%�����	�;�/�/�/�����%�%�%��"�"�$�$�$�$�$r6c�D�|jD]�}|�d|j�d���|�|j|��	|j�|j��}t|j|j|���w#tj	$rd|j_
Y��wxYwdS)Nzcontext.eval_ctx.r0T)�optionsr�rr2r`r*r0�setattrrr3r1)r'r)r*�keywordr7s     r4�visit_EvalContextModifierz'CodeGenerator.visit_EvalContextModifier�s����|�	:�	:�G��N�N�?�w�{�?�?�?�@�@�@��J�J�w�}�e�,�,�,�
:��m�,�,�U�^�<�<�������S�9�9�9�9���#�
/�
/�
/�*.���'�'�'�
/����	:�	:s�A?�?B�Bc�b�|���}|j���}|�|�d���|�||��|jD]}|�||���|j�|��|�d|�d���dS)Nz = context.eval_ctx.save()zcontext.eval_ctx.revert(rB)r�r0�saver�r�rRr2�revert)r'r)r*�old_ctx_name�	saved_ctxr5s      r4�visit_ScopedEvalContextModifierz-CodeGenerator.visit_ScopedEvalContextModifier�s����0�0�2�2���N�'�'�)�)�	����,�B�B�B�C�C�C��&�&�t�U�3�3�3��Y�	%�	%�E��J�J�u�e�$�$�$�$�
����i�(�(�(����A�,�A�A�A�B�B�B�B�Br6�NFTr�r�)r
r.)Nr)r>r?)�r�r�r�r8r�rs�TextIOrnr��propertyrWror�r�r+r�r�r�r�r�Noderrrr�rrFr�rr��Callr�r��Mappingr9r#r.r:r=rDrFr�r�r�r�r_rfrirprsrWrYrXr{r}r�r3r�r�r�r�rZr�r�r�r�r��Includer��Import�
FromImportr�r�r��Forr��Ifr�r�r�FilterBlockr�Withr�ExprStmtr�
NamedTupler�staticmethodrrrr%r(r7r,r/r1�Outputr8�Assignr:�AssignBlockr=r�r��NSRefrBr�rDr+rHrLr�rN�DictrPrM�	visit_Add�	visit_Sub�	visit_Mul�	visit_Div�visit_FloorDiv�	visit_Pow�	visit_Mod�	visit_And�visit_OrrR�	visit_Pos�	visit_Neg�	visit_Notr;�Concatr[�Comparer^�Operandra�Getattrrd�Getitemrgrfrkr�Iteratorrpr�r��CondExprrxr��Keywordr�MarkSafer��MarkSafeIfAutoescaper��EnvironmentAttributer��ExtensionAttributer�r�r��InternalNamer��ContextReferencer��DerivedContextReferencer��Continuer��Breakr��Scoper��OverlayScoper��EvalContextModifierr��ScopedEvalContextModifierr�r�r6r4r(r(,s,�������(,� ��G4�G4�"�G4��j��o�G4��*�S�/�	G4�
�
�1�8�$�G4��
G4��G4�
�G4�G4�G4�G4�R�*�4�*�*�*��X�*�
L��L�S�L�]�L�L�L�L�,�c�,�,�,�,�
/�E�/�d�/�/�/�/�5:�9�9��9�-1�9�	
�9�9�9�9�(����"�"�C�"��"�"�"�"�<�<��<�a�j���.D�<�PT�<�<�<�<��u�������DH�����"��*+�*�U�Z�*@��	
�����	��
�5�:� 6�	�u�	��	�	�	�	��s��t�����IJ������J�u�z�2��BE��	
�����*�*�A�J�u�z�2�*�#�*�d�*�*�*�*�;?�	7/�7/��g�e�j�%�,��
�:�;�7/��7/��j���3���:�!6�7�	7/�

�7/�7/�7/�7/�r)�q�z�%�*�'=�)�$�)�)�)�)�V>��>�4�>�>�>�>� B�B��B�4�B�D�B�B�B�B�H�H��H�C�H�QT�H�H�H�H�2��2��2�2�2�2�Q ��G�E�K���8�9�Q �BG�Q �	
�����	!�Q �Q �Q �Q �f

�8�

�E�

�d�

�

�

�

��U�Z��C�����!��!�#�!�!�!�!�
+�
+�
+�
+�I��I�$�I�I�I�I�$�$�$�$�6�C�6�D�6�6�6�6�5�S�5�T�5�5�5�5�,�,�,�,�1��1�1�1�1�#�#�#�#�#�#�U�E�U�c�U�U�U�U�3�c�3�d�3�3�3�3�)�)�)�)�)O��)O�4�)O�)O�)O�)O�\@D�u9�u9��N�u9�+,�:�e�+<�u9�	
�u9�u9�u9�u9�n)���)�E�)�d�)�)�)�)�V)!�%�-�)!��)!�$�)!�)!�)!�)!�V1�%�-�1��1�$�1�1�1�1�f
U��G�E�L�%�*:�:�;�
U�DI�
U�	
�
U�
U�
U�
U�	N���	N�e�	N��	N�	N�	N�	N�0�U�%5�0�e�0��0�0�0�0�dIP�e�i�IP��IP�$�IP�IP�IP�IP�V�U�X��e�������*/���/�E�/�d�/�/�/�/��E�O��E��d�����	'�e�&7�	'��	'�$�	'�	'�	'�	'�
%�u�z�
%�%�
%�D�
%�
%�
%�
%�%�5�>�%�%�%�D�%�%�%�%����������������1�5�����\��,0�I�q�z�-�(�/�/�/�.�
�.�.�.�.�`#��
�1�5�(9�#�c�#�#�#�#�%��J�%�',�%�8E�%�	�%�%�%�%�*%��J�%�',�%�8E�%�	
�%�%�%�%� 	��J�	�',�	�8E�	�	
�	�	�	�	�M���M�e�M��M�M�M�M�^(���(�e�(��(�(�(�(�&�e�&7�&��&�$�&�&�&�&�0�u�z��%��D�����20���0�E�0�d�0�0�0�0�"���"�E�"�d�"�"�"�"��u�'9��%��D�����.���.�E�.�d�.�.�.�.��u�z��%��D������u�z��%��D�������C� � �I���C� � �I���C� � �I���C� � �I� �[��&�&�N���D�!�!�I���C� � �I���E�"�"�I��{�4� � �H��
�3���I��
�3���I��
�6�"�"�I������e�������]����%�-����$�����]��%�%�-�%��%�$�%�%�%�%��	�%�-�	��	�$�	�	�	��]�	��!�%�-�!��!�$�!�!�!��]�!�()���)�E�)�d�)�)�)�)��'��G�E�L�%�*�4�5�'�>C�'�PT�'�	
��D�	�'�'�'��^�'�R�6���6�e�6��6�6�6��]�6� �)�u�z�)�%�)�D�)�)�)��]�)���5�>��%��D�����]��,�EJ����J��',��>B��	
�����]��,&�%�-�&��&�$�&�&�&�&��5�>��%��D�����
��.��7<��	
�����/��.�/�7<�/�	
�/�/�/�/�
O��,�O�5:�O�	
�O�O�O�O�
9�u�'9�9�%�9�D�9�9�9�9��u�'9��%��D�������*��38��	
�����
/��1�/�:?�/�	
�/�/�/�/�
)�5�>�)�%�)�D�)�)�)�)�&���&�E�&�d�&�&�&�&�&���&�E�&�d�&�&�&�&�%�u�'9�%�%�%�D�%�%�%�%�:��-�:�6;�:�	
�:�:�:�:�
C��3�
C�<A�
C�	
�
C�
C�
C�
C�
C�
Cr6r�)Fr��typingr8�
contextlibr�	functoolsr�ior�	itertoolsrr�rr�
markupsaferr	r?r�
exceptionsr�
idtrackingr
rrrrrr/r�utilsrrrJr�
TYPE_CHECKING�typing_extensions�terCr�TypeVarrr9rr`r;rsrKrMrQrRrZr�r�rnr_rdr�r��Setr�r�r+�RuntimeErrorrr�r~r4r�r(r�r6r4�<module>r�s���6�6�����%�%�%�%�%�%�$�$�$�$�$�$�������������2�2�2�2�2�2�������������������.�.�.�.�.�.�������&�&�&�&�&�&�*�*�*�*�*�*�(�(�(�(�(�(�*�*�*�*�*�*������� � � � � � ������������� � � � � � ��?�)�"�"�"�"�(�(�(�(�(�(�
�A�I�c���C���J�/�0�0�0���
�

��

��
�
�	
�	
�	�
2�Q�
2�1�
2�
2�
2�
2� �C��A�J�����'P�RV�'V�W�����,����Z��%�/�7�;�T�A�B�����2$(�����
�.�����*�S�/���j��o�	�

�J�q�x� ���
����Z��_�����0����4�����"��:�e�j�!��*+�*�S�/���U�3�Z�����&�&�&�&�&�&�&�&�P�P�P�P�P�P�P�P�fJ�J�J�J�J�,�J�J�J�'�'�'�'�'�k�'�'�'�&&�&�&�&�&�K�&�&�&�,�����9����yC�yC�yC�yC�yC�K�yC�yC�yC�yC�yCr6

Zerion Mini Shell 1.0