� <��g�� �x �UdZddlZddlZddlZddlmZddlmZddl m Z ej r ddl Z ddlmZejdd � ��Zejejejejejejejd �Zejeejejejgejffed <ejej ej!d �Z"ejeejejgejffed<ej#ej$ej%ej&ej'ej(d�d�d�Z)ejeejejejgejffed<Gd�de*��Z+Gd�de,��Z-Gd�d��Z.dd dej/e.de.fd�Z0Gd�d e-���Z1Gd�d e1��Z2Gd!�d"e1��Z3Gd#�d$e1��Z4Gd%�d&e2��Z5Gd'�d(e2��Z6Gd)�d*e2��Z7Gd+�d,e2��Z8Gd-�d.e2��Z9Gd/�d0e2��Z:Gd1�d2e2��Z;Gd3�d4e2��Z<Gd5�d6e2��Z=Gd7�d8e2��Z>Gd9�d:e2��Z?Gd;�d<e2��Z@Gd=�d>e2��ZAGd?�d@e2��ZBGdA�dBe2��ZCGdC�dDe1��ZDGdE�dFeD��ZEGdG�dHeD��ZFGdI�dJeD��ZGGdK�dLeD��ZHGdM�dNeD��ZIGdO�dPeI��ZJGdQ�dReI��ZKGdS�dTeI��ZLGdU�dVeI��ZMGdW�dXeI��ZGdY�dZe3��ZNGd[�d\e3��ZOGd]�d^eD��ZPdejQd_d`ej/e.dejLejMejejejejfffda�ZRGdb�dceD��ZSGdd�deeS��ZTGdf�dgeS��ZUGdh�dieD��ZVGdj�dkeD��ZWGdl�dmeD��ZXGdn�doeD��ZYGdp�dqeD��ZZGdr�dseD��Z[Gdt�due3��Z\Gdv�dweE��Z]Gdx�dyeE��Z^Gdz�d{eE��Z_Gd|�d}eE��Z`Gd~�deE��ZaGd��d�eE��ZbGd��d�eE��ZcGd��d�eE��ZdGd��d�eE��ZeGd��d�eF��ZfGd��d�eF��ZgGd��d�eF��ZhGd��d�eD��ZiGd��d�eD��ZjGd��d�eD��ZkGd��d�eD��ZlGd��d�eD��ZmGd��d�eD��ZnGd��d�eD��ZoGd��d�eD��ZpGd��d�e2��ZqGd��d�e2��ZrGd��d�e2��ZsGd��d�e2��ZtGd��d�e2��ZuGd��d�eu��Zvd�ejd�ejdd�fd��Zwexew��e-_y[wdS)�z�AST nodes generated by the parser for the compiler. Also provides some node tree helper functions used by the parser and compiler in order to normalize nodes. �N)�deque)�Markup�)�_PassArg)� Environment� _NodeBound�Node)�bound)�*�/�//�**�%�+�-�_binop_to_func)�notrr� _uaop_to_funcc� �||vS�N���a�bs �\/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/jinja2/nodes.py�<lambda>r-s ��q�A�v��c� �||vSrrrs rrr.s ��!�1�*�r)�eq�ne�gt�gteq�lt�lteq�in�notin�_cmpop_to_funcc��eZdZdZdS)� Impossiblez8Raised if the node could not perform a requested action.N��__name__� __module__� __qualname__�__doc__rrrr)r)2s������B�B�B�Brr)c��eZdZdZd�ZdS)�NodeTypez�A metaclass for nodes that handles the field and attribute inheritance. fields and attributes from the parent class are automatically forwarded to the child.c���dD]�}g}|�t|r|dnt|d����|�|�|d����t |��dks Jd���t |��t t |����ks Jd���t |��||<��|�dd��t� ||||��S) N)�fields� attributesrrrz multiple inheritance not allowedzlayout conflict�abstractF) �extend�getattr�object�get�len�set�tuple� setdefault�type�__new__)�mcs�name�bases�d�attr�storages rr>zNodeType.__new__;s���*� %� %�D�13�G� �N�N�7�u�#@�5��8�8�&�$��K�K� L� L� L� �N�N�1�5�5��r�?�?� +� +� +��u�:�:��?�?�?�$F�?�?�?��w�<�<�3�s�7�|�|�#4�#4�4�4�4�6G�4�4�4��G�n�n�A�d�G�G� � � �Z��'�'�'��|�|�C��u�a�0�0�0rN)r+r,r-r.r>rrrr0r06s-������-�-� 1� 1� 1� 1� 1rr0c��eZdZdZ d dddejeddfd�Zdejeej ffd�Z d ejeej fddfd �Z dS) � EvalContextzcHolds evaluation time information. Custom attributes can be attached to it in extensions. N� environmentr� template_name�returnc��||_t|j��r|�|��|_n |j|_d|_dS�NF)rG�callable� autoescape�volatile)�selfrGrHs r�__init__zEvalContext.__init__LsK��'��� �K�*� +� +� 5�)�4�4�]�C�C�D�O�O�)�4�D�O��� � � rc�4�|j���Sr)�__dict__�copy�rOs r�savezEvalContext.saveVs���}�!�!�#�#�#r�oldc�l�|j���|j�|��dSr)rR�clear�update)rOrVs r�revertzEvalContext.revertYs2�� � ������ � ���S�!�!�!�!�!rr) r+r,r-r.�t�Optional�strrP�Mapping�AnyrUrZrrrrFrFGs��������� LP���(��9:��C��� �����$�a�i��Q�U� �+�$�$�$�$�"�!�)�C���J�/�"�D�"�"�"�"�"�"rrF�node�ctxrIc�^�|�*|j�td���t|j��S|S)NzIif no eval context is passed, the node must have an attached environment.)rG� RuntimeErrorrF)r`ras r�get_eval_contextrd^s?�� �{� � � #��)��� ��4�+�,�,�,� �Jrc ��eZdZUdZdZejedfed<dZ ejedfed<dZ e ed<ej d ed <dej dej d d fd �Z ddej ejedej ejed ejejeej ffd�Z ddej ejedej ejed ejdfd�Zdejed ej efd�Zdejejeejejedffd ejefd�Zded dfd�Zd de ded dfd�Zd!d�Zdej d efd�ZejZd efd�Zd efd�Z d S)"r a�Baseclass for all Jinja nodes. There are a number of nodes available of different types. There are four major types: - :class:`Stmt`: statements - :class:`Expr`: expressions - :class:`Helper`: helper nodes - :class:`Template`: the outermost wrapper node All nodes have fields and attributes. Fields may be other nodes, lists, or arbitrary values. Fields are passed to the constructor as regular positional arguments, attributes as keyword arguments. Each node has two attributes: `lineno` (the line number of the node) and `environment`. The `environment` attribute is set at the end of the parsing process for all nodes automatically. r.r2��linenorGr3TrgrrGrINc ��|jrtd���|r�t|��t|j��kr�|js$tt |��j�d����tt |��j�dt|j���dt|j��dkrdnd�����t |j|��D]\}}t|||���|jD]'}t|||� |d�����(|r,tdtt|���������dS) Nz#abstract nodes are not instantiablez takes 0 argumentsz takes 0 or z argumentr�s�zunknown attribute ) r4� TypeErrorr9r2r=r+�zip�setattrr3�pop�next�iter)rOr2r3r@�argrCs rrPz Node.__init__�sy�� �=� C��A�B�B� B� � )��6�{�{�c�$�+�.�.�.�.��{�R�#�t�D�z�z�':�$P�$P�$P�Q�Q�Q���D�z�z�*�G�G�#�d�k�:J�:J�G�G�'*�4�;�'7�'7�1�'<�'<���"�G�G����!���f�5�5� )� )� ��c���d�C�(�(�(�(��O� <� <�D� �D�$� ���t�T� :� :� ;� ;� ;� ;� � M��K��d�:�6F�6F�1G�1G�K�K�L�L� L� M� Mr�exclude�onlyc#�K�|jD]8}|�|� |�||vs|�*||vr& |t||��fV��(#t$rY�4wxYw�9dS)aZThis method iterates over all fields that are defined and yields ``(key, value)`` tuples. Per default all fields are returned, but it's possible to limit that to some fields by providing the `only` parameter or to exclude some using the `exclude` parameter. Both should be sets or tuples of field names. N)r2r6�AttributeError)rOrrrsr@s r� iter_fieldszNode.iter_fields�s������K� � �D���T�\��'�D��,?�,?��$���������d� 3� 3�3�3�3�3�3��%�����D������ � s �2� ?�?c#��K�|�||��D]R\}}t|t��r|D]}t|t��r|V���9t|t��r|V��SdS)z�Iterates over all direct child nodes of the node. This iterates over all fields and yields the values of they are nodes. If the value of a field is a list all the nodes in that list are returned. N)rv� isinstance�listr )rOrrrs�_�item�ns r�iter_child_nodeszNode.iter_child_nodes�s������'�'���6�6� � �G�A�t��$��%�%� �� � �A�!�!�T�*�*� ������ ��D�$�'�'� �� � � ��  � r� node_typec�<�|�|��D]}|cSdS)ziFind the first node of a given type. If no such node exists the return value is `None`. N)�find_all)rOr~�results r�findz Node.find�s-���m�m�I�.�.� � �F��M�M�M��trc#�K�|���D]1}t||��r|V�|�|��Ed{V���2dS)z�Find all the nodes of a given type. If the type is a tuple, the check is performed for any of the tuple items. N)r}rxr�)rOr~�childs rr�z Node.find_all�so���� �*�*�,�,� 1� 1�E��%��+�+� �� � � ��~�~�i�0�0� 0� 0� 0� 0� 0� 0� 0� 0� 1� 1rrac���t|g��}|rM|���}d|jvr||_|�|�����|�M|S)aReset the context of a node and all child nodes. Per default the parser will all generate nodes that have a 'load' context as it's the most common one. This method is used in the parser to set assignment targets and other nodes to a store context. ra)r�popleftr2rar5r})rOra�todor`s r�set_ctxz Node.set_ctx�si�� �d�V�}�}��� 1��<�<�>�>�D��� �#�#���� �K�K��-�-�/�/� 0� 0� 0� � 1� � rF�overridec���t|g��}|rV|���}d|jvr|j�|r||_|�|�����|�V|S)z.Set the line numbers of the node and children.rg)rr�r3rgr5r})rOrgr�r�r`s r� set_linenozNode.set_lineno�st���d�V�}�}��� 1��<�<�>�>�D��4�?�*�*��;�&�(�&�"(�D�K� �K�K��-�-�/�/� 0� 0� 0� � 1� � rc��t|g��}|rD|���}||_|�|�����|�D|S)z"Set the environment for all nodes.)rr�rGr5r})rOrGr�r`s r�set_environmentzNode.set_environment�s[���d�V�}�}��� 1��<�<�>�>�D�*�D� � �K�K��-�-�/�/� 0� 0� 0�� 1�� r�otherc���t|��t|��urtSt|�����t|�����kSr)r=�NotImplementedr;rv)rOr�s r�__eq__z Node.__eq__�sR�� ��:�:�T�%�[�[� (� (�!� !��T�%�%�'�'�(�(�E�%�2C�2C�2E�2E�,F�,F�F�Frc���d��fd��jD����}t���j�d|�d�S)N�, c3�D�K�|]}|�dt�|d����V��dS)�=N)r6)�.0rrOs �r� <genexpr>z Node.__repr__.<locals>.<genexpr>�s=�����T�T�1��>�>�G�D�!�T�$:�$:�>�>�T�T�T�T�T�Tr�(�))�joinr2r=r+)rO�args_strs` r�__repr__z Node.__repr__�sK����9�9�T�T�T�T�� �T�T�T�T�T���t�*�*�%�3�3��3�3�3�3rc����dtjttjfddf��fd� �g��|��d����S)Nr`rIc���t|t��s$��t|����dS��dt |��j�d���|js��d��dSt|j��D]�\}}|r��d��t||��}t|t��rb��d��t|��D]'\}}|r��d���|���(��d�����|������d��dS)Nznodes.r�r�r��[�]) rxr �append�reprr=r+r2� enumerater6ry)r`�idx�field�valuer{�_dump�bufs ��rr�zNode.dump.<locals>._dump�sU����d�D�)�)� �� � �4��:�:�&�&�&��� �J�J�6��T� � � 3�6�6�6� 7� 7� 7��;� �� � �3������'�� �4�4� !� !� ��U��%��J�J�t�$�$�$���e�,�,���e�T�*�*�!��J�J�s�O�O�O�%.�u�%5�%5�$�$� ��T��-��J�J�t�,�,�,���d� � � � ��J�J�s�O�O�O�O��E�%�L�L�L�L� �J�J�s�O�O�O�O�Orrj)r[�Unionr r_r�)rOr�r�s @@r�dumpz Node.dump�sf���� ����a�e� �,� �� � � � � � � �0�� ��d� � � ��w�w�s�|�|�r�NN)F)rGrrIr )!r+r,r-r.r2r[�Tupler]�__annotations__r3r4�intr\r_rP� Container�Iteratorrvr}�Typerr�r�r�r��boolr�r�r�r7�__hash__r�r�rrrr r is���������� !#�F�A�G�C��H� �"�"�"�$=�J����S��!�=�=�=��H� �K�K�K���M�*�*�*�*�M���M�Q�U�M�t�M�M�M�M�(15�-1�����A�K��,�-���j���S�)�*�� ��A�G�C���J�'� (� ����015�-1�����A�K��,�-���j���S�)�*�� ��F� � ����"�a�f�Z�0��Q�Z� �5K����� 1����� �!3�Q�W�Q�V�J�=O�QT�=T�5U�!U�V� 1� ��J� � 1� 1� 1� 1� �3� �6� � � � � � �� �� �� � � � �����G�A�E�G�d�G�G�G�G� ��H�4�#�4�4�4�4��c������r)� metaclassc��eZdZdZdZdS)�StmtzBase node for all statements.TN�r+r,r-r.r4rrrr�r�s������'�'��H�H�Hrr�c��eZdZdZdZdS)�Helperz,Nodes that exist in a specific context only.TNr�rrrr�r� s������6�6��H�H�Hrr�c�8�eZdZUdZdZejeed<dS)�TemplatezjNode that represents a template. This must be the outermost node that is passed to the compiler. ��bodyr�N� r+r,r-r.r2r[�Listr r�rrrr�r�&s5����������F� �&��,�����rr�c�8�eZdZUdZdZejded<dS)�Outputz�A node that holds multiple expressions which are then printed out. This is used both for the `print` statement and the regular template data. ��nodes�Exprr�N)r+r,r-r.r2r[r�r�rrrr�r�/s5����������F� �6�&�>�����rr�c�"�eZdZUdZdZded<dS)�Extendsz Represents an extends statement.)�templater�r�N)r+r,r-r.r2r�rrrr�r�8s)�������*�*� �F������rr�c��eZdZUdZdZeed<eed<ejeed<ejeed<ej eed<e ed<d S) �ForaxThe for loop. `target` is the target for the iteration (usually a :class:`Name` or :class:`Tuple`), `iter` the iterable. `body` is a list of nodes that are used as loop-body, and `else_` a list of nodes for the `else` block. If no else node exists it has to be an empty list. For filtered nodes an expression can be stored as `test`, otherwise `None`. )�targetrpr��else_�test� recursiver�rpr�r�r�r�N) r+r,r-r.r2r r�r[r�r\r�rrrr�r�?st���������F�F� �L�L�L� �J�J�J� �&��,���� �6�$�<���� �*�T� �����O�O�O�O�Orr�c��eZdZUdZdZeed<ejeed<ejded<ejeed<dS)�Ifz4If `test` is true, `body` is rendered, else `else_`.)r�r��elif_r�r�r�r�r�N) r+r,r-r.r2r r�r[r�rrrr�r�Qs\�������>�>� /�F� �J�J�J� �&��,���� �6�$�<���� �6�$�<�����rr�c��eZdZUdZdZeed<ejded<ejded<eje ed<d S) �Macroz�A macro definition. `name` is the name of the macro, `args` a list of arguments and `defaults` a list of defaults if there are any. `body` is a list of nodes for the macro body. )r@�args�defaultsr�r@�Namer�r�r�r�N) r+r,r-r.r2r]r�r[r�r rrrr�r�[sb��������� 2�F� �I�I�I� �&��.�����f�V�n���� �&��,�����rr�c��eZdZUdZdZded<ejded<ejded<ejeed <d S) � CallBlockz�Like a macro without a name but a call instead. `call` is called with the unnamed macro as `caller` argument this node holds. )�callr�r�r��Callr�r�r�r�r�r�N) r+r,r-r.r2r�r[r�r rrrr�r�hsb���������2�F� �L�L�L� �&��.�����f�V�n���� �&��,�����rr�c�B�eZdZUdZdZejeed<ded<dS)� FilterBlockzNode for filter sections.)r��filterr��Filterr�Nr�rrrr�r�ts;�������#�#� �F� �&��,���� �����rr�c�x�eZdZUdZdZejded<ejded<ejeed<dS)�Withz�Specific node for with statements. In older versions of Jinja the with statement was implemented on the base of the `Scope` node instead. .. versionadded:: 2.9.3 )�targets�valuesr�r�r�r�r�N) r+r,r-r.r2r[r�r�r rrrr�r�|sY��������� +�F� �V�F�^���� �F�6�N���� �&��,�����rr�c�V�eZdZUdZdZeed<eje ed<e ed<e ed<dS)�BlockzkA node that represents a block. .. versionchanged:: 3.0.0 the `required` field was added. )r@r��scoped�requiredr@r�r�r�N) r+r,r-r.r2r]r�r[r�r r�rrrr�r��sN��������� 4�F� �I�I�I� �&��,���� �L�L�L��N�N�N�N�Nrr�c�6�eZdZUdZdZded<eed<eed<dS)�Includez'A node that represents the include tag.)r�� with_context�ignore_missingr�r�r�r�N)r+r,r-r.r2r�r�rrrr�r��sA�������1�1� ;�F��������������rr�c�6�eZdZUdZdZded<eed<eed<dS)�Importz&A node that represents the import tag.)r�r�r�r�r�r�r�N)r+r,r-r.r2r�r]r�rrrr�r��s>�������0�0� 3�F����� �K�K�K������rr�c��eZdZUdZdZded<ejeje ej e e ffed<e ed<dS)� FromImportaA node that represents the from import tag. It's important to not pass unsafe names to the name attribute. The compiler translates the attribute lookups directly into getattr calls and does *not* use the subscript callback of the interface. As exported variables may not start with double underscores (which the parser asserts) this is not a problem for regular Jinja code, but if this node is used in an extension extra care must be taken. The list of names may contain tuples if aliases are wanted. )r��namesr�r�r�r�r�N) r+r,r-r.r2r�r[r�r�r]r�r�rrrr�r��se������� � �3�F����� �6�!�'�#�q�w�s�C�x�0�0�1� 2�2�2�2������rr�c�"�eZdZUdZdZeed<dS)�ExprStmtzAA statement that evaluates an expression and discards the result.�r`r`N)r+r,r-r.r2r r�rrrr�r��s$�������K�K� �F� �J�J�J�J�Jrr�c�,�eZdZUdZdZded<eed<dS)�Assignz"Assigns an expression to a target.)r�r`r�r�r`N)r+r,r-r.r2r�r rrrr�r��s-�������,�,� �F� �N�N�N� �J�J�J�J�Jrr�c�b�eZdZUdZdZded<ejded<eje ed<dS) � AssignBlockzAssigns a block to a target.)r�r�r�r�r�r�r�r�N) r+r,r-r.r2r�r[r\r�r rrrr�r��sK�������&�&� )�F� �N�N�N� �J�x� � � � � �&��,�����rr�c�T�eZdZdZdZddejedejfd�Z de fd�Z dS) r�zBaseclass for all expressions.TN�eval_ctxrIc��t���)anReturn the value of the expression as constant or raise :exc:`Impossible` if this was not possible. An :class:`EvalContext` can be provided, if none is given a default context is created which requires the nodes to have an attached environment. .. versionchanged:: 2.4 the `eval_ctx` parameter was added. )r)�rOr�s r�as_constz Expr.as_const�s���l�l�rc��dS)z8Check if it's possible to assign something to this node.FrrTs r� can_assignzExpr.can_assign�s���urr) r+r,r-r.r4r[r\rFr_r�r�r�rrrr�r��sj������(�(��H� � ���K�!8� �A�E� � � � ��D������rr�c�l�eZdZUdZdZeed<eed<eed<dZd de j e d e j fd �Z dS) �BinExprz%Baseclass for all binary expressions.)�left�rightr�r�operatorTNr�rIc�\�t||��}|jjr!|j|jjvrt ���t |j} ||j�|��|j �|����S#t$r}t ��|�d}~wwxYwr) rdrG� sandboxedr�intercepted_binopsr)rr�r�r� Exception�rOr��f�es rr�zBinExpr.as_const�s���#�D�(�3�3�� � � *� �� ��!5�!H�H�H��,�,� � �4�=� )�� &��1�T�Y�'�'��1�1�4�:�3F�3F�x�3P�3P�Q�Q� Q��� &� &� &��,�,�A� %����� &���s�;B � B+�B&�&B+r�r+r,r-r.r2r�r�r]r4r[r\rFr_r�rrrr�r��sq�������/�/� �F� �J�J�J� �K�K�K��M�M�M��H� &� &���K�!8� &�A�E� &� &� &� &� &� &rr�c�b�eZdZUdZdZeed<eed<dZd de j e de j fd �Z dS) � UnaryExprz$Baseclass for all unary expressions.r�r`rTNr�rIc�*�t||��}|jjr!|j|jjvrt ���t |j} ||j�|����S#t$r}t ��|�d}~wwxYwr) rdrGrr�intercepted_unopsr)rr`r�rrs rr�zUnaryExpr.as_const s���#�D�(�3�3�� � � *� �� ��!5�!G�G�G��,�,� � �$�-� (�� &��1�T�Y�'�'��1�1�2�2� 2��� &� &� &��,�,�A� %����� &���s�"A4�4 B�>B � Brr rrrr r sh�������.�.� �F� �J�J�J��M�M�M��H� &� &���K�!8� &�A�E� &� &� &� &� &� &rr c�8�eZdZUdZdZeed<eed<defd�ZdS)r�a Looks up a name or stores a value in a name. The `ctx` of the node can be one of the following values: - `store`: store a value in the name - `load`: load that name - `param`: like `store` but if the name was defined as function parameter. )r@rar@rarIc��|jdvS)N>�None�True�none�true�False�false�r@rTs rr�zName.can_assign(s���y� R�R�RrN� r+r,r-r.r2r]r�r�r�rrrr�r�s[����������F� �I�I�I� �H�H�H�S�D�S�S�S�S�S�Srr�c�8�eZdZUdZdZeed<eed<defd�ZdS)�NSRefz)Reference to a namespace value assignment)r@rCr@rCrIc��dS)NTrrTs rr�zNSRef.can_assign3s �� �trNrrrrrr,sN�������3�3� �F� �I�I�I� �I�I�I��D������rrc��eZdZdZdZdS)�LiteralzBaseclass for literals.TNr�rrrrr;s������!�!��H�H�Hrrc ��eZdZUdZdZejed<d deje dejfd�Z e d dejdeje d d ddfd ���Z dS)�ConstaAll constant values. The parser will return this node for simple constants such as ``42`` or ``"foo"`` but it can be used to store more complex values such as lists too. Only constants with a safe representation (objects where ``eval(repr(x)) == x`` is true). �r�r�Nr�rIc��|jSrrr�s rr�zConst.as_constKs ���z�rrgrGzt.Optional[Environment]c�\�ddlm}||��st���||||���S)z�Return a const object if the value is representable as constant value in the generated code, otherwise it will raise an `Impossible` exception. r)� has_safe_reprrf)�compilerr"r))�clsr�rgrGr"s r�from_untrustedzConst.from_untrustedNsI�� ,�+�+�+�+�+��}�U�#�#� ��,�,� ��s�5��[�A�A�A�Arrr�)r+r,r-r.r2r[r_r�r\rFr�� classmethodr�r%rrrrrAs���������� �F� �5�L�L�L�����K�!8��A�E������#'�15� B�B��u�B�� �3��B�/� B� � B�B�B��[�B�B�Brrc�J�eZdZUdZdZeed<ddeje defd�Z dS) � TemplateDatazA constant template string.)�datar)Nr�rIc��t||��}|jrt���|jrt |j��S|jSr)rdrNr)rMrr)r�s rr�zTemplateData.as_constfsI��#�D�(�3�3�� � � ��,�,� � � � %��$�)�$�$� $��y�rr) r+r,r-r.r2r]r�r[r\rFr�rrrr(r(`sX�������%�%� �F� �I�I�I�����K�!8��C������rr(c��eZdZUdZdZejeed<e ed<d dej e dej ej dffd �Zdefd �ZdS) r�z�For loop unpacking and some other things like multiple arguments for subscripts. Like for :class:`Name` `ctx` specifies if the tuple is used for loading the names or storing. )�itemsrar,raNr�rI.c�d��t|����t�fd�|jD����S)Nc3�B�K�|]}|����V��dSr�r��r��xr�s �rr�z!Tuple.as_const.<locals>.<genexpr>{s/�����>�>�a�Q�Z�Z��)�)�>�>�>�>�>�>r)rdr;r,r�s `rr�zTuple.as_constys7���#�D�(�3�3���>�>�>�>�4�:�>�>�>�>�>�>rc�H�|jD]}|���sdS�dS)NFT)r,r�)rOr{s rr�zTuple.can_assign}s6���J� � �D��?�?�$�$� ��u�u� ��trr)r+r,r-r.r2r[r�r�r�r]r\rFr�r_r�r�r�rrrr�r�os���������� �F� �6�$�<���� �H�H�H�?�?���K�!8�?�A�G�A�E�SV�J�DW�?�?�?�?��D������rr�c��eZdZUdZdZejeed<ddej e dejej fd�Z dS) r�z&Any list literal such as ``[1, 2, 3]``�r,r,Nr�rIc�J��t|�����fd�|jD��S)Nc�:��g|]}|������Srr/r0s �r� <listcomp>z!List.as_const.<locals>.<listcomp>�s%���9�9�9��� � �8�$�$�9�9�9r)rdr,r�s `rr�z List.as_const�s.���#�D�(�3�3��9�9�9�9�d�j�9�9�9�9rr) r+r,r-r.r2r[r�r�r�r\rFr_r�rrrr�r��si�������0�0� �F� �6�$�<����:�:���K�!8�:�A�F�1�5�M�:�:�:�:�:�:rr�c��eZdZUdZdZejded< d deje dej ej ej ffd�Z dS) �DictzeAny dict literal such as ``{1: 2, 3: 4}``. The items must be a list of :class:`Pair` nodes. r4�Pairr,Nr�rIc�d��t|����t�fd�|jD����S)Nc3�B�K�|]}|����V��dSrr/r0s �rr�z Dict.as_const.<locals>.<genexpr>�s/�����=�=�Q�A�J�J�x�(�(�=�=�=�=�=�=r)rd�dictr,r�s `rr�z Dict.as_const�s9���$�D�(�3�3���=�=�=�=�$�*�=�=�=�=�=�=rr) r+r,r-r.r2r[r�r�r\rFr9r_r�rrrr9r9�s}����������F� �6�&�>����37�>�>�� �;�/�>� ����q�u� � �>�>�>�>�>�>rr9c��eZdZUdZdZeed<eed< d deje dej ej ej ffd�Z dS) r:zA key, value pair for dicts.��keyr�r@r�Nr�rIc��t||��}|j�|��|j�|��fSr)rdr@r�r�r�s rr�z Pair.as_const�s>��$�D�(�3�3���x� � ��*�*�D�J�,?�,?��,I�,I�I�Irr) r+r,r-r.r2r�r�r[r\rFr�r_r�rrrr:r:�s��������&�&� �F� �I�I�I� �K�K�K�37�J�J�� �;�/�J� ������� �J�J�J�J�J�Jrr:c�x�eZdZUdZdZeed<eed<d dej e dej eej ffd�Z dS) �Keywordz>A key, value pair for keyword arguments where key is a string.r?r@r�Nr�rIc�d�t||��}|j|j�|��fSr)rdr@r�r�r�s rr�zKeyword.as_const�s.��#�D�(�3�3���x���,�,�X�6�6�6�6rr)r+r,r-r.r2r]r�r�r[r\rFr�r_r�rrrrCrC�sp�������H�H� �F� �H�H�H� �K�K�K�7�7���K�!8�7�A�G�C�QR�QV�J�DW�7�7�7�7�7�7rrCc�~�eZdZUdZdZeed<eed<ejeed<d deje dej fd �Z dS) �CondExprzZA conditional expression (inline if expression). (``{{ foo if bar else baz }}``) )r��expr1�expr2r�rGrHNr�rIc���t||��}|j�|��r|j�|��S|j�t ���|j�|��Sr)rdr�r�rGrHr)r�s rr�zCondExpr.as_const�si��#�D�(�3�3�� �9� � �h� '� '� 1��:�&�&�x�0�0� 0� �:� ��,�,� ��z�"�"�8�,�,�,rr) r+r,r-r.r2r�r�r[r\rFr_r�rrrrFrF�s|���������(�F� �J�J�J� �K�K�K� �:�d� ���� -� -���K�!8� -�A�E� -� -� -� -� -� -rrF)�_FilterTestCommonr�r�c�����fd�|jD��}t�fd�|jD����}|j�P |�|j������n!#t $r}t��|�d}~wwxYw|j�P |� |j������n!#t $r}t��|�d}~wwxYw||fS)Nc�:��g|]}|������Srr/r0s �rr7z!args_as_const.<locals>.<listcomp>�s%��� 4� 4� 4�Q�A�J�J�x� � � 4� 4� 4rc3�B�K�|]}|����V��dSrr/r0s �rr�z args_as_const.<locals>.<genexpr>�s/�����<�<�1�!�*�*�X�&�&�<�<�<�<�<�<r) r�r=�kwargs�dyn_argsr5r�rr)� dyn_kwargsrY)r`r�r�rNrs ` r� args_as_constrQ�s ��� 5� 4� 4� 4�$�)� 4� 4� 4�D� �<�<�<�<�� �<�<�<� <� <�F� �}� � &� �K�K�� �.�.�x�8�8� 9� 9� 9� 9��� &� &� &��,�,�A� %����� &���� ��"� &� �M�M�$�/�2�2�8�<�<� =� =� =� =��� &� &� &��,�,�A� %����� &���� ��<�s/�-A+�+ B �5B�B �-C� C � C�C c���eZdZUdZeed<eed<ejeed<eje ed<ej eed<ej eed<dZ dZ d d ej e d ejfd �Zd S)rJ)r`r@r�rNrOrPr`r@r�rNrOrPTNr�rIc��t||��}|jrt���|jr |jj}n |jj}|�|j��}tj |��}|�|tj urt���|jj r5t|dd��dustj|��rt���t!||��\}}|�d|j�|����|tjur|�d|��n)|tjur|�d|j�� ||i|��S#t*$r}t��|�d}~wwxYw)N�jinja_async_variantFTr)rdrNr)� _is_filterrG�filters�testsr8r@r�from_obj�context�is_asyncr6�inspect�iscoroutinefunctionrQ�insertr`r�� eval_contextr)rOr��env_map�func�pass_argr�rNrs rr�z_FilterTestCommon.as_const�s���#�D�(�3�3�� � � ��,�,� � �?� 1��*�2�G�G��*�0�G��{�{�4�9�%�%���$�T�*�*�� �<�8�x�'7�7�7��,�,� � � � (� � �D�/�� 7� 7�4� ?� ?��*�4�0�0� @��,�,� �$�T�8�4�4� ��f� � � �A�t�y�)�)�(�3�3�4�4�4� �x�,� ,� ,� �K�K��8� $� $� $� $� ��-� -� -� �K�K��8�/� 0� 0� 0� &��4��(��(�(� (��� &� &� &��,�,�A� %����� &���s�#E+�+ F �5F�F r)r+r,r-r2r�r�r]r[r�r:r\r4rUrFr_r�rrrrJrJ�s�������� I�F� �J�J�J� �I�I�I� �&��,���� �F�4�L�����j������� �4� � � � ��H��J�"&�"&���K�!8�"&�A�E�"&�"&�"&�"&�"&�"&rrJc�p��eZdZUdZejeed<ddejedej f�fd� Z �xZ S)r�z�Apply a filter to an expression. ``name`` is the name of the filter, the other fields are the same as :class:`Call`. If ``node`` is ``None``, the filter is being used in a filter block and is applied to the content of the block. r`Nr�rIc�r��|j�t���t���|���S)N)r�)r`r)�superr�)rOr�� __class__s �rr�zFilter.as_consts0��� �9� ��,�,� ��w�w�����2�2�2rr) r+r,r-r.r[r\r�r�rFr_r�� __classcell__)res@rr�r�sz���������� �*�T� ����3�3���K�!8�3�A�E�3�3�3�3�3�3�3�3�3�3rr�c��eZdZdZdZdS)�Testa/Apply a test to an expression. ``name`` is the name of the test, the other field are the same as :class:`Call`. .. versionchanged:: 3.0 ``as_const`` shares the same logic for filters and tests. Tests check for volatile, async, and ``@pass_context`` etc. decorators. FN)r+r,r-r.rUrrrrhrh$s���������J�J�Jrrhc��eZdZUdZdZeed<ejeed<eje ed<ej eed<ej eed<dS) r�a/Calls an expression. `args` is a list of arguments, `kwargs` a list of keyword arguments (list of :class:`Keyword` nodes), and `dyn_args` and `dyn_kwargs` has to be either `None` or a node that is used as node for dynamic positional (``*args``) or keyword (``**kwargs``) arguments. )r`r�rNrOrPr`r�rNrOrPN) r+r,r-r.r2r�r�r[r�rCr\rrrr�r�1sw���������B�F� �J�J�J� �&��,���� �F�7�O�����j������� �4� � � � � � rr�c�h�eZdZUdZdZeed<eed<eed<d dej e dej fd �Z dS) �Getitemz@Get an attribute or item from an expression and prefer the item.)r`rqrar`rqraNr�rIc�.�|jdkrt���t||��} |j�|j�|��|j�|����S#t$r}t��|�d}~wwxYw�N�load) rar)rdrG�getitemr`r�rqr�rOr�rs rr�zGetitem.as_constIs��� �8�v� � ��,�,� �#�D�(�3�3�� &��'�/�/�� �"�"�8�,�,�d�h�.?�.?��.I�.I��� ��� &� &� &��,�,�A� %����� &���s�A A6�6 B�B�Br� r+r,r-r.r2r�r�r]r[r\rFr_r�rrrrkrkAsl�������J�J� #�F� �J�J�J� �I�I�I� �H�H�H� &� &���K�!8� &�A�E� &� &� &� &� &� &rrkc�h�eZdZUdZdZeed<eed<eed<d dej e dej fd �Z dS) �GetattrznGet an attribute or item from an expression that is a ascii-only bytestring and prefer the attribute. )r`rCrar`rCraNr�rIc��|jdkrt���t||��} |j�|j�|��|j��S#t$r}t��|�d}~wwxYwrm) rar)rdrGr6r`r�rCrrps rr�zGetattr.as_constas��� �8�v� � ��,�,� �#�D�(�3�3�� &��'�/�/�� �0B�0B�8�0L�0L�d�i�X�X� X��� &� &� &��,�,�A� %����� &���s�7A#�# B�-A<�<BrrqrrrrsrsWsr���������%�F� �J�J�J� �I�I�I� �H�H�H� &� &���K�!8� &�A�E� &� &� &� &� &� &rrsc��eZdZUdZdZejeed<ejeed<ejeed<d deje de fd �Z dS) �Slicez_Represents a slice object. This must only be used as argument for :class:`Subscript`. )�start�stop�steprwrxryNr�rIc� ��t|����dtjtdtjtjf�fd� }t ||j��||j��||j����S)N�objrIc�6��|�dS|����Srr/)r{r�s �r�constzSlice.as_const.<locals>.constzs����{��t��<�<��)�)� )r) rdr[r\r�r_�slicerwrxry)rOr�r}s ` rr�zSlice.as_constws����#�D�(�3�3�� *�q�z�$�'� *�A�J�q�u�,=� *� *� *� *� *� *� �U�U�4�:�&�&���d�i�(8�(8�%�%�� �:J�:J�K�K�Krr) r+r,r-r.r2r[r\r�r�rFr~r�rrrrvrvms����������'�F� �:�d� ���� �*�T� ���� �*�T� ����L�L���K�!8�L�E�L�L�L�L�L�Lrrvc�`�eZdZUdZdZejeed<ddej e de fd�Z dS) �ConcatzXConcatenates the list of expressions provided after converting them to strings. r�r�Nr�rIc�p��t|����d��fd�|jD����S)Nrjc3�\�K�|]&}t|������V��'dSr)r]r�r0s �rr�z"Concat.as_const.<locals>.<genexpr>�s7�����E�E�Q�s�1�:�:�h�/�/�0�0�E�E�E�E�E�Er)rdr�r�r�s `rr�zConcat.as_const�s;���#�D�(�3�3���w�w�E�E�E�E�$�*�E�E�E�E�E�Err) r+r,r-r.r2r[r�r�r�r\rFr]r�rrrr�r��sp����������F� �6�$�<����F�F���K�!8�F�C�F�F�F�F�F�Frr�c�t�eZdZUdZdZeed<ejded<d dej e dej fd �Z dS) �CompareziCompares an expression with some other expressions. `ops` must be a list of :class:`Operand`\s. )�expr�opsr��Operandr�Nr�rIc�0�t||��}|j�|��x}} |jD]>}|j�|��}t |j||��}|sdS|}�?n!#t $r}t��|�d}~wwxYw|SrK)rdr�r�r�r'�oprr))rOr�r�r�r�� new_valuers rr�zCompare.as_const�s���#�D�(�3�3����+�+�H�5�5�5��� &��h� "� "���G�,�,�X�6�6� �'���.�u�i�@�@���!� �5�5�!��� "��� &� &� &��,�,�A� %����� &����� s�AA5�1A5�5 B�?B�Br) r+r,r-r.r2r�r�r[r�r\rFr_r�rrrr�r��ss����������F� �J�J�J� �� � ��������K�!8��A�E������rr�c�,�eZdZUdZdZeed<eed<dS)r�z$Holds an operator and an expression.)r�r�r�r�N)r+r,r-r.r2r]r�r�rrrr�r��s-�������.�.� �F� �G�G�G� �J�J�J�J�Jrr�c��eZdZdZdZdS)�Mulz(Multiplies the left with the right node.r N�r+r,r-r.rrrrr�r��s������2�2��H�H�Hrr�c��eZdZdZdZdS)�Divz#Divides the left by the right node.r Nr�rrrr�r��s������-�-��H�H�Hrr�c��eZdZdZdZdS)�FloorDivzbDivides the left by the right node and converts the result into an integer by truncating. r Nr�rrrr�r��s���������H�H�Hrr�c��eZdZdZdZdS)�AddzAdd the left to the right node.rNr�rrrr�r��s������)�)��H�H�Hrr�c��eZdZdZdZdS)�Subz&Subtract the right from the left node.rNr�rrrr�r��s������0�0��H�H�Hrr�c��eZdZdZdZdS)�ModzLeft modulo right.rNr�rrrr�r��s���������H�H�Hrr�c��eZdZdZdZdS)�PowzLeft to the power of right.rNr�rrrr�r��s������%�%��H�H�Hrr�c�H�eZdZdZdZddejedejfd�Z dS)�AndzShort circuited AND.�andNr�rIc��t||��}|j�|��o|j�|��Sr�rdr�r�rr�s rr�z And.as_const�s<��#�D�(�3�3���y�!�!�(�+�+�M�� �0C�0C�H�0M�0M�Mrr� r+r,r-r.rr[r\rFr_r�rrrr�r��sX���������H�N�N���K�!8�N�A�E�N�N�N�N�N�Nrr�c�H�eZdZdZdZddejedejfd�Z dS)�OrzShort circuited OR.�orNr�rIc��t||��}|j�|��p|j�|��Srr�r�s rr�z Or.as_const�s<��#�D�(�3�3���y�!�!�(�+�+�L�t�z�/B�/B�8�/L�/L�Lrrr�rrrr�r��sX���������H�M�M���K�!8�M�A�E�M�M�M�M�M�Mrr�c��eZdZdZdZdS)�NotzNegate the expression.rNr�rrrr�r��s������ � ��H�H�Hrr�c��eZdZdZdZdS)�NegzMake the expression negative.rNr�rrrr�r��s������'�'��H�H�Hrr�c��eZdZdZdZdS)�Posz8Make the expression positive (noop for most expressions)rNr�rrrr�r��s������B�B��H�H�Hrr�c�"�eZdZUdZdZeed<dS)�EnvironmentAttributez�Loads an attribute from the environment object. This is useful for extensions that want to call a callback stored on the environment. rr@N�r+r,r-r.r2r]r�rrrr�r�s*����������F� �I�I�I�I�Irr�c�,�eZdZUdZdZeed<eed<dS)�ExtensionAttributez�Returns the attribute of an extension bound to the environment. The identifier is the identifier of the :class:`Extension`. This node is usually constructed by calling the :meth:`~jinja2.ext.Extension.attr` method on an extension. )� identifierr@r�r@Nr�rrrr�r�s3���������$�F��O�O�O� �I�I�I�I�Irr�c�"�eZdZUdZdZeed<dS)� ImportedNamea&If created with an import name the import name is returned on node access. For example ``ImportedName('cgi.escape')`` returns the `escape` function from the cgi module on evaluation. Imports are optimized by the compiler so there is no need to assign them to local variables. )� importnamer�Nr�rrrr�r�s*��������� �F��O�O�O�O�Orr�c�*�eZdZUdZdZeed<dd�ZdS)� InternalNamea6An internal name in the compiler. You cannot create these nodes yourself but the parser provides a :meth:`~jinja2.parser.Parser.free_identifier` method that creates a new identifier for you. This identifier is not available from the template and is not treated specially by the compiler. rr@rINc� �td���)NzKCan't create internal names. Use the `free_identifier` method on a parser.�rkrTs rrPzInternalName.__init__4s��� 4� � � r)rIN)r+r,r-r.r2r]r�rPrrrr�r�)sD����������F� �I�I�I� � � � � � rr�c�J�eZdZUdZdZeed<ddeje de fd�Z dS) �MarkSafez:Mark the wrapped expression as safe (wrap it as `Markup`).�r�r�Nr�rIc�p�t||��}t|j�|����Sr)rdrr�r�r�s rr�zMarkSafe.as_constAs/��#�D�(�3�3���d�i�(�(��2�2�3�3�3rr) r+r,r-r.r2r�r�r[r\rFrr�rrrr�r�;sX�������D�D� �F� �J�J�J�4�4���K�!8�4�F�4�4�4�4�4�4rr�c�p�eZdZUdZdZeed< ddeje dej e ej ffd�Z dS) �MarkSafeIfAutoescapez�Mark the wrapped expression as safe (wrap it as `Markup`) but only if autoescaping is active. .. versionadded:: 2.5 r�r�Nr�rIc��t||��}|jrt���|j�|��}|jrt |��S|Sr)rdrNr)r�r�rMr)rOr�r�s rr�zMarkSafeIfAutoescape.as_constPsY��$�D�(�3�3�� � � ��,�,� ��y�!�!�(�+�+�� � � ��$�<�<� �� rr)r+r,r-r.r2r�r�r[r\rFr�rr_r�rrrr�r�Fsr��������� �F� �J�J�J�37� � �� �;�/� � ������ � � � � � � rr�c��eZdZdZdS)�ContextReferenceaMReturns the current template context. It can be used like a :class:`Name` node, with a ``'load'`` ctx and will return the current :class:`~jinja2.runtime.Context` object. Here an example that assigns the current template name to a variable named `foo`:: Assign(Name('foo', ctx='store'), Getattr(ContextReference(), 'name')) This is basically equivalent to using the :func:`~jinja2.pass_context` decorator when using the high-level API, which causes a reference to the context to be passed as the first argument to a function. Nr*rrrr�r�\s���������rr�c��eZdZdZdS)�DerivedContextReferencez�Return the current template context including locals. Behaves exactly like :class:`ContextReference`, but includes local variables, such as from a ``for`` loop. .. versionadded:: 2.11 Nr*rrrr�r�ns���������rr�c��eZdZdZdS)�ContinuezContinue a loop.Nr*rrrr�r�ws���������rr�c��eZdZdZdS)�Breakz Break a loop.Nr*rrrr�r�{s���������rr�c�8�eZdZUdZdZejeed<dS)�ScopezAn artificial scope.r�r�Nr�rrrr�r�s/��������� �F� �&��,�����rr�c�B�eZdZUdZdZeed<eje ed<dS)� OverlayScopea�An overlay scope for extensions. This is a largely unoptimized scope that however can be used to introduce completely arbitrary variables into a sub scope from a dictionary or dictionary like object. The `context` field has to evaluate to a dictionary object. Example usage:: OverlayScope(context=self.call_method('get_context'), body=[...]) .. versionadded:: 2.10 )rYr�rYr�N) r+r,r-r.r2r�r�r[r�r rrrr�r��s>������� � �!�F� �M�M�M� �&��,�����rr�c�8�eZdZUdZdZejeed<dS)�EvalContextModifiera Modifies the eval context. For each option that should be modified, a :class:`Keyword` has to be added to the :attr:`options` list. Example to change the `autoescape` setting:: EvalContextModifier(options=[Keyword('autoescape', Const(True))]) )�optionsr�N) r+r,r-r.r2r[r�rCr�rrrr�r��s5����������F� �V�G�_�����rr�c�8�eZdZUdZdZejeed<dS)�ScopedEvalContextModifierz�Modifies the eval context and reverts it later. Works exactly like :class:`EvalContextModifier` but will only modify the :class:`~jinja2.nodes.EvalContext` for nodes in the :attr:`body`. r�r�Nr�rrrr�r��s5��������� �F� �&��,�����rr�r�rNz te.NoReturnc� �td���)Nzcan't create custom node typesr�)r�rNs r� _failing_newr��s�� �4� 5� 5�5r)zr.r[r�typingr[� collectionsr� markupsafer�utilsr� TYPE_CHECKING�typing_extensions�terGr�TypeVarr�mul�truediv�floordiv�pow�mod�add�subrr9r]�Callabler_r��not_�pos�negrrr r!�ger#�ler'rr)r=r0rFr\rdr r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r r�rrrr(r�r�r:rCrFr�rQrJr�rhr�rkrsrvr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�� staticmethodr>rrr�<module>r�s������ �������������������������������?�)�"�"�"�"�(�(�(�(�(�(� �Q�Y�|�6� 2� 2� 2� � �� � � � � �,� �� �� ��B�B����s�A�J���q�u�~�q�u�'<�=�=�>���� �=� �� ��:�:� �q�v�c�1�:�q�u�g�q�u�n�5�5�6���� �+� �+� �+� �K� �+� �K� � � $� $� B� B����s�A�J���q�u�~�q�u�'<�=�=�>� � � �C�C�C�C�C��C�C�C�1�1�1�1�1�t�1�1�1�""�"�"�"�"�"�"�"�.�6��� �;�(?��K�����n�n�n�n�n�X�n�n�n�n�b�����4���� �����T���� �����t���������T���������d���������$����$��������� � � � � �D� � � � � � � � �� � � ������$���� � � � � �4� � � � � � � � �D� � � ������d���������T�������������$�����t���������T���������$���������4����.&�&�&�&�&�d�&�&�&�2&�&�&�&�&��&�&�&�0S�S�S�S�S�4�S�S�S�" � � � � �D� � � ������d���� B�B�B�B�B�G�B�B�B�> � � � � �7� � � ������G����*:�:�:�:�:�7�:�:�:� >� >� >� >� >�7� >� >� >� J� J� J� J� J�6� J� J� J� 7� 7� 7� 7� 7�f� 7� 7� 7�-�-�-�-�-�t�-�-�-�,� �'�-� .��:;�*�[�:Q���W�Q�V�A�E�]�A�F�1�5�!�%�<�0� 0�1�����*-&�-&�-&�-&�-&��-&�-&�-&�`3�3�3�3�3� �3�3�3�" � � � � � � � � � !� !� !� !� !�4� !� !� !� &�&�&�&�&�d�&�&�&�,&�&�&�&�&�d�&�&�&�,L�L�L�L�L�D�L�L�L�* F� F� F� F� F�T� F� F� F������d����8�����f���������'���� �����'���� �����w���������'���� �����'���� �����'���� �����'���� N�N�N�N�N�'�N�N�N�M�M�M�M�M��M�M�M������)���� �����)���� �����)���������4���� � � � � �� � � ������4���� � � � � �4� � � �$4�4�4�4�4�t�4�4�4������4����,�����t����$�����d���������t���������D���������D���������4����& � � � � �$� � � ������ 3����6���6���6�=�6�6�6�6� �<� �-�-����L�Lr
Memory