Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
nodes.cpython-313.pyc476 linesDownload Raw Back to __pycache__
1�

2��j��3�$�%SrSSKrSSKrSSKrSSKJr SSKJr SSK	J4r5 \R(a6SSKr
SSKJr \R "SS	S79r\R$\R&\R(\R*\R,\R.\R0S.r\R4\\R8\R:\R:/\R:44\S'\R>\R@\RBS
.r"\R4\\R8\R:/\R:44\S'\RF\RH\RJ\RL\RN\RPSSS.r)\R4\\R8\R:\R:/\R:44\S'"SS\*5r+"SS\,5r-"SS5r.SS	S\R^\.S\.4Sjr0"SS	\-S9r1"SS \15r2"S!S"\15r3"S#S$\15r4"S%S&\25r5"S'S(\25r6"S)S*\25r7"S+S,\25r8"S-S.\25r9"S/S0\25r:"S1S2\25r;"S3S4\25r<"S5S6\25r="S7S8\25r>"S9S:\25r?"S;S<\25r@"S=S>\25rA"S?S@\25rB"SASB\25rC"SCSD\15rD"SESF\D5rE"SGSH\D5rF"SISJ\D5rG"SKSL\D5rH"SMSN\D5rI"SOSP\I5rJ"SQSR\I5rK"SSST\I5rL"SUSV\I5rM"SWSX\I5r"SYSZ\35rN"S[S\\35rO"S]S^\D5rPS\R�S_S`\R^\.S\R�\R�\R:\R4\R:\R:444SajrR"SbSc\D5rS"SdSe\S5rT"SfSg\S5rU"ShSi\D5rV"SjSk\D5rW"SlSm\D5rX"SnSo\D5rY"SpSq\D5rZ"SrSs\D5r["StSu\35r\"SvSw\E5r]"SxSy\E5r^"SzS{\E5r_"S|S}\E5r`"S~S\E5ra"S�S�\E5rb"S�S�\E5rc"S�S�\E5rd"S�S�\E5re"S�S�\F5rf"S�S�\F5rg"S�S�\F5rh"S�S�\D5ri"S�S�\D5rj"S�S�\D5rk"S�S�\D5rl"S�S�\D5rm"S�S�\D5rn"S�S�\D5ro"S�S�\D5rp"S�S�\25rq"S�S�\25rr"S�S�\25rs"S�S�\25rt"S�S�\25ru"S�S�\u5rvS�\R:S�\R:SS�4S�jrw\x"\w5\-lyCwg)�z�AST nodes generated by the parser for the compiler. Also provides8some node tree helper functions used by the parser and compiler in order9to normalize nodes.10�N)�deque)�Markup�)�_PassArg)�Environment�11_NodeBound�Node)�bound)�*�/�//�**�%�+�-�_binop_to_func)�notrr�
_uaop_to_funcc�12�X;$�N���a�bs  �RD:\code\apps\devtools\python\user_packages\Python313\site-packages\jinja2/nodes.py�<lambda>r-s��q�v�c�13�X;$rrrs  rrr.s��!�*r)�eq�ne�gt�gteq�lt�lteq�in�notin�_cmpop_to_funcc��\rSrSrSrSrg)�14Impossible�2z8Raised if the node could not perform a requested action.rN��__name__�15__module__�__qualname__�__firstlineno__�__doc__�__static_attributes__rrrr)r)2s��Brr)c��\rSrSrSrSrSrg)�NodeType�6z�A metaclass for nodes that handles the field and attribute16inheritance.  fields and attributes from the parent class are17automatically forwarded to the child.c��SH�n/nUR[U(aUSO[US55 URURUS55 [	U5S::dS5e[	U5[	[U55:XdS5e[
U5X4'M� URSS5 [RXX#5$)	N)�fields�18attributesrrrz multiple inheritance not allowedzlayout conflict�abstractF)19�extend�getattr�object�get�len�set�tuple�20setdefault�type�__new__)�mcs�name�bases�d�attr�storages      rrB�NodeType.__new__;s���*�D�13�G��N�N�7�u�5��8�&�$��K�L��N�N�1�5�5��r�?�+��u�:��?�F�$F�F�?��w�<�3�s�7�|�#4�4�G�6G�G�4��G�n�A�G�
+�	21���Z��'��|�|�C�u�0�0rrN)r,r-r.r/r0rBr1rrrr3r36s��-�	1rr3c���\rSrSrSrS
SSS\R\SS4SjjrS\R\\R44S	jrS22\R\\R4SS4SjrSr
g)�EvalContext�Gz[Holds evaluation time information.  Custom attributes can be attached23to it in extensions.24N�environmentr�
template_name�returnc��Xl[UR5(aURU5UlOURUlSUlg�NF)rM�callable�25autoescape�volatile)�selfrMrNs   r�__init__�EvalContext.__init__LsA��'���K�*�*�+�+�)�4�4�]�C�D�O�)�4�4�D�O���
rc�6�URR5$r)�__dict__�copy�rUs r�save�EvalContext.saveVs���}�}�!�!�#�#r�oldc�n�URR5 URRU5 gr)rY�clear�update)rUr^s  r�revert�EvalContext.revertYs$���
�
�����
�
���S�!r)rSrMrTr)r,r-r.r/r0�t�Optional�strrV�Mapping�Anyr\rbr1rrrrKrKGst���26LP��(��9:���C���	
��$�a�i�i��Q�U�U�27�+�$�"�!�)�)�C����J�/�"�D�"rrK�node�ctxrOc�f�Uc-URc[S5e[UR5$U$)NzIif no eval context is passed, the node must have an attached environment.)rM�RuntimeErrorrK)rirjs  r�get_eval_contextrm^s=��28�{����#��)��
��4�+�+�,�,��Jrc29���\rSrSr%SrSr\R\S4\	S'Sr30\R\S4\	S'Sr\\	S	'\RS31\	S'S\RS\RSS
4SjrSS\R\R \S\R\R \S\R"\R\\R44SjjrSS\R\R \S\R\R \S\R"S4SjjrS\R(\S\R\4SjrS\R.\R(\\R\R(\S44S\R"\4SjrS\SS4SjrS S	\S\SS4SjjrS!SjrS\RS\4Sjr\R>rS\4Sjr S\4Sjr!Sr"g
)"r	�ia�Baseclass for all Jinja nodes.  There are a number of nodes available32of different types.  There are four major types:33 34-   :class:`Stmt`: statements35-   :class:`Expr`: expressions36-   :class:`Helper`: helper nodes37-   :class:`Template`: the outermost wrapper node38 39All nodes have fields and attributes.  Fields may be other nodes, lists,40or arbitrary values.  Fields are passed to the constructor as regular41positional arguments, attributes as keyword arguments.  Each node has42two attributes: `lineno` (the line number of the node) and `environment`.43The `environment` attribute is set at the end of the parsing process for44all nodes automatically.45r.r6��linenorMr7TrqrrMrONc	��UR(a[S5eU(a�[U5[UR5:wa�UR(d"[[	U5R46<S35e[[	U5R47<S[UR5S[UR5S:waS35eS35e[
URU5Hup4[XU5 M URHn[XURUS55 M! U(a![S[[U55<35eg)	Nz#abstract nodes are not instantiablez takes 0 argumentsz takes 0 or z	 argumentr�s�zunknown attribute )r8�	TypeErrorr=r6rAr,�zip�setattrr7�pop�next�iter)rUr6r7rD�argrGs      rrV�
Node.__init__�s���=�=��A�B�B���6�{�c�$�+�+�.�.��{�{�#�t�D�z�':�':�&=�=O�$P�Q�Q���D�z�*�*�-�\�#�d�k�k�:J�9K��s�4�;�;�'7�1�'<��E�G���BD�E�G���!����f�5�	����C�(�6��O�O�D��D�48���t�T� :�;�$���0��d�:�6F�1G�0J�K�L�L�r�exclude�onlyc#�# �URH-nUcUbUbX1;dUcMX2;dMU[X54v� M/ g![a M?f=f7f)a2This method iterates over all fields that are defined and yields49``(key, value)`` tuples.  Per default all fields are returned, but50it's possible to limit that to some fields by providing the `only`51parameter or to exclude some using the `exclude` parameter.  Both52should be sets or tuples of field names.53N)r6r:�AttributeError)rUr}r~rDs    r�iter_fields�Node.iter_fields�s[����K�K�D���T�\��'�D�,?��$������� 3�3�3� ��&����s,�A�A�A�A�54A�A�A�Ac#��# �URX5H[up4[U[5(a&UHn[U[5(dMUv� M  M@[U[5(dMWUv� M] g7f)z�Iterates over all direct child nodes of the node.  This iterates55over all fields and yields the values of they are nodes.  If the value56of a field is a list all the nodes in that list are returned.57N)r��58isinstance�listr	)rUr}r~�_�item�ns      r�iter_child_nodes�Node.iter_child_nodes�s[����'�'��6�G�A��$��%�%��A�!�!�T�*�*�����D�$�'�'��59�
7�s�AA4�60A4�+	A4�	node_typec�8�URU5HnUs $ g)zYFind the first node of a given type.  If no such node exists the61return value is `None`.62N)�find_all)rUr��results   r�find�	Node.find�s!���m�m�I�.�F��M�/�rc#�# �UR5H0n[X!5(aUv� URU5Shv�N M2 gN	7f)zpFind all the nodes of a given type.  If the type is a tuple,63the check is performed for any of the tuple items.64N)r�r�r�)rUr��childs   rr��
Node.find_all�sA����*�*�,�E��%�+�+����~�~�i�0�0�0�-�
1�s�<A65�A�66A67rjc���[U/5nU(aNUR5nSUR;aXlUR	UR55 U(aMNU$)z�Reset the context of a node and all child nodes.  Per default the68parser will all generate nodes that have a 'load' context as it's the69most common one.  This method is used in the parser to set assignment70targets and other nodes to a store context.71rj)r�popleftr6rjr9r�)rUrj�todoris    r�set_ctx�Node.set_ctx�sQ���d�V�}����<�<�>�D�����#����K�K��-�-�/�0�	�d�72�r�overridec���[U/5nU(abUR5nSUR;aURbU(aXlUR	UR55 U(aMbU$)z.Set the line numbers of the node and children.rq)rr�r7rqr9r�)rUrqr�r�ris     r�73set_lineno�Node.set_lineno�s[���d�V�}����<�<�>�D��4�?�?�*��;�;�&�(�"(�K��K�K��-�-�/�0��d��rc��[U/5nU(a>UR5nXlURUR	55 U(aM>U$)z"Set the environment for all nodes.)rr�rMr9r�)rUrMr�ris    r�set_environment�Node.set_environment�sD���d�V�}����<�<�>�D�*���K�K��-�-�/�0��d��r�otherc��[U5[U5La[$[UR55[UR55:H$r)rA�NotImplementedr?r�)rUr�s  r�__eq__�Node.__eq__�s?����:�T�%�[�(�!�!��T�%�%�'�(�E�%�2C�2C�2E�,F�F�Frc�^�SRU4SjTR55n[T5RSUS3$)N�, c3�H># �UHoS[TUS5<3v� M g7f)�=N)r:)�.0rrUs  �r�	<genexpr>� Node.__repr__.<locals>.<genexpr>�s$����T��1�s�!�G�D�!�T�$:�#=�>��s�"�(�))�joinr6rAr,)rU�args_strs` r�__repr__�
Node.__repr__�s9����9�9�T����T�T���t�*�%�%�&�a��z��3�3rc�^^�S[R[[R4SS4UU4Sjjm/mT"U5 SR	T5$)NrirOc�>�[U[5(dTR[U55 gTRS[	U5R74S35 UR(dTRS5 g[UR5H�upU(aTRS5 [X5n[U[5(aXTRS5 [U5H%upU(aTRS5 T"U5 M' TRS5 M�T"U5 M� TRS5 g)Nznodes.r�r�r��[�])75r�r	�append�reprrAr,r6�	enumerater:r�)ri�idx�field�valuer��_dump�bufs     ��rr��Node.dump.<locals>._dump�s�����d�D�)�)��76�77�4��:�&���J�J���T�78� 3� 3�4�A�6�7��;�;��79�80�3���'����4�81����J�J�t�$���,���e�T�*�*��J�J�s�O�%.�u�%5�	����J�J�t�,��d��&6��J�J�s�O��%�L�5�
�J�J�s�Orrt)rd�Unionr	rhr�)rUr�r�s @@r�dump�	Node.dump�sH���	�����a�e�e��,�	��	�	�0��
�d���w�w�s�|�r�NN)F)rMrrOr	)#r,r-r.r/r0r6rd�Tuplerf�__annotations__r7r8�intrerhrV�	Container�Iteratorr�r��Typerr�r�r�r��boolr�r�r�r;�__hash__r�r�r1rrrr	r	is��� !#�F�A�G�G�C��H��"�$=�J�����S��!�=��H��K����M�*�*�M����M�Q�U�U�M�t�M�(15�-1�����A�K�K��,�-���j�j����S�)�*��82���A�G�G�C����J�'�	(�	�015�-1�����A�K�K��,�-���j�j����S�)�*��83���F�	�	�"�a�f�f�Z�0��Q�Z�Z�84�5K��	1�������85�!3�Q�W�W�Q�V�V�J�=O�QT�=T�5U�!U�V�	1�	86���J�	�	1��3��6��	��	��	��	��G�A�E�E�G�d�G����H�4�#�4��c�r)�	metaclassc��\rSrSrSrSrSrg)�StmtizBase node for all statements.TrN�r,r-r.r/r0r8r1rrrr�r�s87��'��Hrr�c��\rSrSrSrSrSrg)�Helperi z,Nodes that exist in a specific context only.TrNr�rrrr�r� s88��6��Hrr�c�B�\rSrSr%SrSr\R\\	S'Sr89g)�Templatei&zbNode that represents a template.  This must be the outermost node that90is passed to the compiler.91��bodyr�rN�r,r-r.r/r0r6rd�Listr	r�r1rrrr�r�&s����F�92�&�&��,�rr�c�B�\rSrSr%SrSr\RS\S'Sr	g)�Outputi/z�A node that holds multiple expressions which are then printed out.93This is used both for the `print` statement and the regular template data.94��nodes�Exprr�rN)95r,r-r.r/r0r6rdr�r�r1rrrr�r�/s����F��6�6�&�>�rr�c�(�\rSrSr%SrSrS\S'Srg)�Extendsi8z Represents an extends statement.)�templater�r�rN)r,r-r.r/r0r6r�r1rrrr�r�8s��*�
�F��rr�c��\rSrSr%SrSr\\S'\\S'\R\\S'\R\\S'\R\\S'\\S	'S96rg)�Fori?adThe for loop.  `target` is the target for the iteration (usually a97:class:`Name` or :class:`Tuple`), `iter` the iterable.  `body` is a list98of nodes that are used as loop-body, and `else_` a list of nodes for the99`else` block.  If no else node exists it has to be an empty list.100 101For filtered nodes an expression can be stored as `test`, otherwise `None`.102)�targetrzr��else_�test�	recursiver�rzr�r�r�r�rN)
r,r-r.r/r0r6r	r�rdr�rer�r1rrrr�r�?sI���F�F��L�103�J�104�&�&��,���6�6�$�<��105�*�*�T�106���Orr�c��\rSrSr%SrSr\\S'\R\\S'\RS\S'\R\\S'Sr107g	)108�IfiQz4If `test` is true, `body` is rendered, else `else_`.)r�r��elif_r�r�r�r�r�rN)r,r-r.r/r0r6r	r�rdr�r1rrrr�r�Qs9��>�
/�F�109�J�110�&�&��,���6�6�$�<���6�6�$�<�rr�c��\rSrSr%SrSr\\S'\RS\S'\RS\S'\R\111\S	'S112rg)�Macroi[z�A macro definition.  `name` is the name of the macro, `args` a list of113arguments and `defaults` a list of defaults if there are any.  `body` is114a list of nodes for the macro body.115)rD�args�defaultsr�rD�Namer�r�r�r�rN)r,r-r.r/r0r6rfr�rdr�r	r1rrrr�r�[s=���1162�F�117
�I�118�&�&��.���f�f�V�n��119�&�&��,�rr�c��\rSrSr%SrSrS\S'\RS\S'\RS\S	'\R\	\S120'Sr121g)
�	CallBlockihzLike a macro without a name but a call instead.  `call` is called with122the unnamed macro as `caller` argument this node holds.123)�callr�r�r��Callr�r�r�r�r�r�rN)r,r-r.r/r0r6r�rdr�r	r1rrrr�r�hs=���2�F�124�L�125�&�&��.���f�f�V�n��126�&�&��,�rr�c�L�\rSrSr%SrSr\R\\	S'S\	S'Sr127g)	�FilterBlockitzNode for filter sections.)r��filterr��Filterr�rNr�rrrr�r�ts��#�
�F�128�&�&��,���rr�c��\rSrSr%SrSr\RS\S'\RS\S'\R\	\S'Sr129g	)130�Withi|z�Specific node for with statements.  In older versions of Jinja the131with statement was implemented on the base of the `Scope` node instead.132 133.. versionadded:: 2.9.3134)�targets�valuesr�r�r�r�r�rN)r,r-r.r/r0r6rdr�r�r	r1rrrr�r�|s8���+�F�
�V�V�F�^��
�F�F�6�N��135�&�&��,�rr�c�`�\rSrSr%SrSr\\S'\R\136\S'\\S'\\S'Srg	)137�Blocki�z_A node that represents a block.138 139.. versionchanged:: 3.0.0140    the `required` field was added.141)rDr��scoped�requiredrDr�r�r�rN)
r,r-r.r/r0r6rfr�rdr�r	r�r1rrrr�r��s+���4�F�142
�I�143�&�&��,���L��Nrr�c�<�\rSrSr%SrSrS\S'\\S'\\S'Srg	)144�Includei�z'A node that represents the include tag.)r��with_context�ignore_missingr�r�r�rrN)	r,r-r.r/r0r6r�r�r1rrrr�r��s��1�
;�F������rr�c�<�\rSrSr%SrSrS\S'\\S'\\S'Sr	g	)145�Importi�z&A node that represents the import tag.)r�r�r�r�r�r�r�rN)146r,r-r.r/r0r6r�rfr�r1rrrrr�s��0�
3�F����K��rrc��\rSrSr%SrSrS\S'\R\R\147\R\148\14944\S'\\S'Sr
g	)150�151FromImporti�a�A node that represents the from import tag.  It's important to not152pass unsafe names to the name attribute.  The compiler translates the153attribute lookups directly into getattr calls and does *not* use the154subscript callback of the interface.  As exported variables may not155start with double underscores (which the parser asserts) this is not a156problem for regular Jinja code, but if this node is used in an extension157extra care must be taken.158 159The list of names may contain tuples if aliases are wanted.160)r��namesr�r�r�rr�rN)r,r-r.r/r0r6r�rdr�r�rfr�r�r1rrrrr�sD��	�3�F����6�6�!�'�'�#�q�w�w�s�C�x�0�0�1�2�2��rrc�(�\rSrSr%SrSr\\S'Srg)�ExprStmti�zAA statement that evaluates an expression and discards the result.�ririrN)	r,r-r.r/r0r6r	r�r1rrrrr�s��K�
�F�161�Jrrc�2�\rSrSr%SrSrS\S'\\S'Srg)	�Assigni�z"Assigns an expression to a target.)r�rir�r�rirN)	r,r-r.r/r0r6r�r	r1rrrr162r163�s��,�
�F��N�164�Jrr165c�p�\rSrSr%SrSrS\S'\RS\S'\R\166\S'S	rg167)�AssignBlocki�zAssigns a block to a target.)r�r�r�r�r�r�r�r�rN)r,r-r.r/r0r6r�rdrer�r	r1rrrrr�s,��&�
)�F��N�
�J�J�x� � �168�&�&��,�rrc�n�\rSrSrSrSrS169S\R\S\R4Sjjr170S\4SjrS	r
g)r�i�zBaseclass for all expressions.TN�eval_ctxrOc��[5e)a6Return the value of the expression as constant or raise171:exc:`Impossible` if this was not possible.172 173An :class:`EvalContext` can be provided, if none is given174a default context is created which requires the nodes to have175an attached environment.176 177.. versionchanged:: 2.4178   the `eval_ctx` parameter was added.179)r)�rUrs  r�as_const�
Expr.as_const�s���l�rc��g)z8Check if it's possible to assign something to this node.Frr[s r�180can_assign�Expr.can_assign�s��rrr)r,r-r.r/r0r8rdrerKrhrr�rr1rrrr�r��s6��(��H�����K�!8��A�E�E���D�rr�c��\rSrSr%SrSr\\S'\\S'\\S'Sr	S
S	\181R\S182\183R4SjjrSrg)�BinExpri�z%Baseclass for all binary expressions.)�left�rightrr�operatorTNrrOc��[X5nURR(a.URURR;a184[5e[URnU"URRU5URRU55$![an[5UeSnAff=fr)rmrM�	sandboxedr�intercepted_binopsr)rrrr�	Exception�rUr�f�es    rr�BinExpr.as_const�s���#�D�3��
� � �*�*��
�
��!5�!5�!H�!H�H��,���4�=�=�)��	&��T�Y�Y�'�'��1�4�:�:�3F�3F�x�3P�Q�Q���	&��,�A�%��	&�s�):B$�$185B>�.B9�9B>rr�r,r-r.r/r0r6r�r�rfr8rdrerKrhrr1rrrrr�sC��/�
�F�186�J��K��M��H�
&����K�!8�
&�A�E�E�
&�
&rrc�z�\rSrSr%SrSr\\S'\\S'Sr	SS\187R\S	\188R4S189jjrSrg)
�	UnaryExpriz$Baseclass for all unary expressions.rrirTNrrOc�N�[X5nURR(a.URURR;a190[5e[URnU"URRU55$![an[5UeSnAff=fr)191rmrMrr�intercepted_unopsr)rrirrrs    rr�UnaryExpr.as_consts���#�D�3��
� � �*�*��
�
��!5�!5�!G�!G�G��,���$�-�-�(��	&��T�Y�Y�'�'��1�2�2���	&��,�A�%��	&�s�) B192�193 194B$�B�B$rrr#rrrr%r%s>��.�
�F�195�J��M��H�
&����K�!8�
&�A�E�E�
&�
&rr%c�@�\rSrSr%SrSr\\S'\\S'S\4Sjr	Sr196g	)197r�iz�Looks up a name or stores a value in a name.198The `ctx` of the node can be one of the following values:199 200-   `store`: store a value in the name201-   `load`: load that name202-   `param`: like `store` but if the name was defined as function parameter.203)rDrjrDrjrOc� �URS;$)N>�None�True�none�true�False�false�rDr[s rr�Name.can_assign(s���y�y� R�R�RrrN�r,r-r.r/r0r6rfr�r�rr1rrrr�r�s&����F�204
�I�	�H�S�D�Srr�c�@�\rSrSr%SrSr\\S'\\S'S\4Sjr	Sr205g	)206�NSRefi,z)Reference to a namespace value assignment)rDrGrDrGrOc��g)NTrr[s rr�NSRef.can_assign3s��207rrNr3rrrr5r5,s ��3�
�F�208
�I�209
�I��D�rr5c��\rSrSrSrSrSrg)�Literali;zBaseclass for literals.TrNr�rrrr9r9;s210��!��Hrr9c211���\rSrSr%SrSr\R\S'SS\R\212S\R4Sjjr\SS\RS	\R\
S213SSS4Sjj5rS
rg)�ConstiAaAll constant values.  The parser will return this node for simple214constants such as ``42`` or ``"foo"`` but it can be used to store more215complex values such as lists too.  Only constants with a safe216representation (objects where ``eval(repr(x)) == x`` is true).217�r�r�NrrOc��UR$rr<rs  rr�Const.as_constKs���z�z�rrqrMzt.Optional[Environment]c�J�SSKJn U"U5(d218[5eU"XUS9$)z�Return a const object if the value is representable as219constant value in the generated code, otherwise it will raise220an `Impossible` exception.221r)�
has_safe_reprrp)�compilerr@r))�clsr�rqrMr@s     r�from_untrusted�Const.from_untrustedNs'��	,��U�#�#��,���5�[�A�Arrrr�)r,r-r.r/r0r6rdrhr�rerKr�classmethodr�rCr1rrrr;r;As�����F��5�5�L�����K�!8��A�E�E���#'�15�	B��u�u�B��222�223�3��B�/�	B�224225�B��Brr;c�X�\rSrSr%SrSr\\S'S226S\R\227S\4SjjrS	rg)�TemplateDatai`zA constant template string.)�datarHNrrOc��[X5nUR(a228[5eUR(a[	UR2295$UR230$r)rmrTr)rSrrHrs  rr�TemplateData.as_constfs?��#�D�3������,������$�)�)�$�$��y�y�rrr)
r,r-r.r/r0r6rfr�rdrerKrr1rrrrGrG`s0��%�
�F�231
�I�����K�!8��C��rrGc��\rSrSr%SrSr\R\\	S'\232\	S'S
S\R\S\R\RS	44S233jjrS\4SjrSrg)r�ioz�For loop unpacking and some other things like multiple arguments234for subscripts.  Like for :class:`Name` `ctx` specifies if the tuple235is used for loading the names or storing.236)�itemsrjrLrjNrrO.c�Z^�[UT5m[U4SjUR55$)Nc3�D># �UHoRT5v� M g7fr�r�r��xrs  �rr��!Tuple.as_const.<locals>.<genexpr>{s����>�:�a�Z�Z��)�)�:��� )rmr?rLrs `rr�Tuple.as_constys$���#�D�(�3���>�4�:�:�>�>�>rc�X�URHnUR5(aM g g)NFT)rLr)rUr�s  rr�Tuple.can_assign}s%���J�J�D��?�?�$�$���rrr)r,r-r.r/r0r6rdr�r�r�rfrerKr�rhrr�rr1rrrr�r�os[���237�F��6�6�$�<��	�H�?����K�!8�?�A�G�G�A�E�E�SV�J�DW�?��D�rr�c��\rSrSr%SrSr\R\\	S'S238S\R\S\R\R4Sjjr
S	rg)r�i�z&Any list literal such as ``[1, 2, 3]``�rLrLNrrOc�x�[X5nURVs/sHo"RU5PM sn$s snfr)rmrLr)rUrrQs   rr�
List.as_const�s/��#�D�3��.2�j�j�9�j��239�240�8�$�j�9�9��9s�7rr)r,r-r.r/r0r6rdr�r�r�rerKrhrr1rrrr�r��sE��0�
�F��6�6�$�<��:����K�!8�:�A�F�F�1�5�5�M�:�:rr�c��\rSrSr%SrSr\RS\S'SS\R\241S\R\R\R44S	jjr
S242rg)�Dicti�z]Any dict literal such as ``{1: 2, 3: 4}``.  The items must be a list of243:class:`Pair` nodes.244rX�PairrLNrrOc�Z^�[UT5m[U4SjUR55$)Nc3�D># �UHoRT5v� M g7frrOrPs  �rr�� Dict.as_const.<locals>.<genexpr>�s����=�*�Q�J�J�x�(�(�*�rS)rm�dictrLrs `rr�
Dict.as_const�s&���$�D�(�3���=�$�*�*�=�=�=rrr)r,r-r.r/r0r6rdr�r�rerKr\rhrr1rrrr\r\�sY����F��6�6�&�>��37�>��245�246�;�/�>�	247������q�u�u��	�>�>rr\c��\rSrSr%SrSr\\S'\\S'SS\R\248S\R\R\R44S	jjr
S249rg)r]i�zA key, value pair for dicts.��keyr�rer�NrrOc��[X5nURRU5URRU54$r)rmrerr�rs  rr�
Pair.as_const�s7��$�D�3���x�x� � ��*�D�J�J�,?�,?��,I�I�Irrr)r,r-r.r/r0r6r�r�rdrerKr�rhrr1rrrr]r]�sU��&�
�F�	
�I��K�37�J��250�251�;�/�J�	252����������	�J�Jrr]c��\rSrSr%SrSr\\S'\\S'SS\	R\S\	R\\	R44S	jjrS253rg)�Keywordi�z>A key, value pair for keyword arguments where key is a string.rdrer�NrrOc�f�[X5nURURRU54$r)rmrer�rrs  rr�Keyword.as_const�s*��#�D�3���x�x����,�,�X�6�6�6rrr)r,r-r.r/r0r6rfr�r�rdrerKr�rhrr1rrrriri�sI��H�
�F�	�H��K�7����K�!8�7�A�G�G�C�QR�QV�QV�J�DW�7�7rric��\rSrSr%SrSr\\S'\\S'\R\\S'SS\R\254S	\R4S255jjrSr
g)
�CondExpri�zRA conditional expression (inline if expression).  (``{{256foo if bar else baz }}``)257)r��expr1�expr2r�rnroNrrOc���[X5nURRU5(aURRU5$URc258[5eURRU5$r)rmr�rrnror)rs  rr�CondExpr.as_const�s_��#�D�3���9�9���h�'�'��:�:�&�&�x�0�0��:�:���,���z�z�"�"�8�,�,rrr)r,r-r.r/r0r6r�r�rdrerKrhrr1rrrrmrm�sL���(�F�259�J��K��:�:�d���	-����K�!8�	-�A�E�E�	-�	-rrm)�_FilterTestCommonr�rc�^�URVs/sHo"RT5PM nn[U4SjUR55nURb+URURRT55 URb.URURRT55 X44$X44$s snf![an[5UeSnAff=f![an[5UeSnAff=f)Nc3�D># �UHoRT5v� M g7frrOrPs  �rr�� args_as_const.<locals>.<genexpr>�s����<��1�*�*�X�&�&��rS)260r�rra�kwargs�dyn_argsr9rr)�261dyn_kwargsra)rirrQr�rvr!s `    r�
args_as_constry�s����+/�)�)�4�)�Q�J�J�x� �)�D�4�
�<����<�
<�F��}�}� �	&��K�K��
�
�.�.�x�8�9����"�	&��M�M�$�/�/�2�2�8�<�=��<��4�<���5���	&��,�A�%��	&���	&��,�A�%��	&�s5�C�*C�*C#�262C �C�C �#263C=�-C8�8C=c�264�\rSrSr%Sr\\S'\\S'\R\\S'\R\265\S'\R\\S'\R\\S'S	rS	r
SS\R\S\R4S
jjrSrg266)rri�)rirDr�rvrwrxrirDr�rvrwrxTNrrOc�r�[X5nUR(a267[5eUR(aURR268nOURRnURUR5n[R"U5nUbU[RLa269[5eURR(a5[USS5SLd[R"U5(a270[5e[!X5upVUR#SUR$R'U55 U[R(LaUR#SU5 O/U[RLaUR#SUR5 U"U0UD6$![*an[5UeSnAff=f)N�jinja_async_variantFTr)rmrTr)�271_is_filterrM�filters�testsr<rDr�from_obj�context�is_asyncr:�inspect�iscoroutinefunctionry�insertrir�eval_contextr)rUr�env_map�func�pass_argr�rvr!s        rr�_FilterTestCommon.as_const�sR��#�D�3������,���?�?��*�*�2�2�G��*�*�0�0�G��{�{�4�9�9�%���$�$�T�*���<�8�x�'7�'7�7��,�����(�(��D�/��7�4�?��*�*�4�0�0��,��$�T�4������A�t�y�y�)�)�(�3�4��x�,�,�,��K�K��8�$�
��-�-�
-��K�K��8�/�/�0�	&���(��(�(���	&��,�A�%��	&�s�F�272F6�&F1�1F6rr)r,r-r.r/r6r�r�rfrdr�r]rer8r}rKrhrr1rrrrrrr�sz��
I�F�273�J�274
�I�275�&�&��,��
�F�F�4�L���j�j�����276�277�4� � ��H��J�"&����K�!8�"&�A�E�E�"&�"&rrrc�^�\rSrSr%Sr\R\\S'SS\R\	S\R4U4SjjjrSrU=r
$)	r�iz�Apply a filter to an expression. ``name`` is the name of the278filter, the other fields are the same as :class:`Call`.279 280If ``node`` is ``None``, the filter is being used in a filter block281and is applied to the content of the block.282rirrOc�L>�URc283[5e[TU]
US9$)N)r)rir)�superr)rUr�	__class__s  �rr�Filter.as_consts(����9�9���,���w����2�2rrr)r,r-r.r/r0rdrer�r�rKrhrr1�
__classcell__)r�s@rr�r�s>�����*�*�T�284��3����K�!8�3�A�E�E�3�3rr�c��\rSrSrSrSrSrg)�Testi$aApply a test to an expression. ``name`` is the name of the test,285the other field are the same as :class:`Call`.286 287.. versionchanged:: 3.0288    ``as_const`` shares the same logic for filters and tests. Tests289    check for volatile, async, and ``@pass_context`` etc.290    decorators.291FrN)r,r-r.r/r0r}r1rrrr�r�$s����Jrr�c��\rSrSr%SrSr\\S'\R\\S'\R\292\S'\R\\S'\R\\S'S	rg293)r�i1aCalls an expression.  `args` is a list of arguments, `kwargs` a list294of keyword arguments (list of :class:`Keyword` nodes), and `dyn_args`295and `dyn_kwargs` has to be either `None` or a node that is used as296node for dynamic positional (``*args``) or keyword (``**kwargs``)297arguments.298)rir�rvrwrxrir�rvrwrxrN)
r,r-r.r/r0r6r�r�rdr�rirer1rrrr�r�1sN���B�F�299�J�300�&�&��,��
�F�F�7�O���j�j�����301�302�4� � rr�c��\rSrSr%SrSr\\S'\\S'\\S'SS\	R\S	\	R4S303jjr
Srg)
�GetitemiAz@Get an attribute or item from an expression and prefer the item.)rir{rjrir{rjNrrOc�$�URS:wa304[5e[X5nURR	UR305R
U5URR
U55$![an[5UeSnAff=f�N�load)	rjr)rmrM�getitemrirr{r�rUrr!s   rr�Getitem.as_constIs}���8�8�v���,��#�D�3��	&��'�'�/�/��	�	�"�"�8�,�d�h�h�.?�.?��.I��
���	&��,�A�%��	&�s�A
A5�5306B�?B307�308Brr�r,r-r.r/r0r6r�r�rfrdrerKrhrr1rrrr�r�As>��J�
#�F�309�J�	
�I�	�H�&����K�!8�&�A�E�E�&�&rr�c��\rSrSr%SrSr\\S'\\S'\\S'SS\	R\S	\	R4S310jjr
Srg)
�GetattriWzfGet an attribute or item from an expression that is a ascii-only311bytestring and prefer the attribute.312)rirGrjrirGrjNrrOc��URS:wa313[5e[X5nURR	UR314R
U5UR5$![an[5UeSnAff=fr�)	rjr)rmrMr:rirrGrr�s   rr�Getattr.as_constask���8�8�v���,��#�D�3��	&��'�'�/�/��	�	�0B�0B�8�0L�d�i�i�X�X���	&��,�A�%��	&�s�>A&�&315B�0A;�;Brrr�rrrr�r�WsB���%�F�316�J�317
�I�	�H�	&����K�!8�	&�A�E�E�	&�	&rr�c��\rSrSr%SrSr\R\\	S'\R\\	S'\R\\	S'SS\R\318S	\4S319jjrSr
g)
�SliceimzWRepresents a slice object.  This must only be used as argument for320:class:`Subscript`.321)�start�stop�stepr�r�r�NrrOc�^�[UT5mS[R[S[R[R4U4Sjjn[U"UR5U"UR5U"UR55$)N�objrOc�.>�UcgURT5$rrO)r�rs �r�const�Slice.as_const.<locals>.constzs����{���<�<��)�)r)	rmrdrer�rh�slicer�r�r�)rUrr�s ` rr�Slice.as_constwsd���#�D�(�3��	*�q�z�z�$�'�	*�A�J�J�q�u�u�,=�	*�322�U�4�:�:�&��d�i�i�(8�%��	�	�:J�K�Krrr)r,r-r.r/r0r6rdrer�r�rKr�rr1rrrr�r�ms`���'�F��:�:�d���323�*�*�T�324��325�*�*�T�326��L����K�!8�L�E�L�Lrr�c�r�\rSrSr%SrSr\R\\	S'S327S\R\S\4Sjjr
S	rg)�Concati�zPConcatenates the list of expressions provided after converting328them to strings.329r�r�NrrOc�f^�[UT5mSRU4SjUR55$)Nrtc3�X># �UHn[URT55v� M! g7fr)rfrrPs  �rr��"Concat.as_const.<locals>.<genexpr>�s"����E�*�Q�s�1�:�:�h�/�0�0�*�s�'*)rmr�r�rs `rr�Concat.as_const�s(���#�D�(�3���w�w�E�$�*�*�E�E�Errr)r,r-r.r/r0r6rdr�r�r�rerKrfrr1rrrr�r��sA����F��6�6�$�<��F����K�!8�F�C�F�Frr�c��\rSrSr%SrSr\\S'\RS\S'SS\R\S	\R4S330jjr
Srg)
�Comparei�zaCompares an expression with some other expressions.  `ops` must be a331list of :class:`Operand`\s.332)�expr�opsr��Operandr�NrrOc�4�[X5nURRU5=p#URHBnURRU5n[UR333"X55nU(d gUnMD U$![an[5UeSnAff=frQ)rmr�rr�r'�oprr))rUrr�r�r��	new_valuer!s       rr�Compare.as_const�s���#�D�3�����+�+�H�5�5��334	&��h�h���G�G�,�,�X�6�	�'����.�u�@��� �!����
���	&��,�A�%��	&�s�AA=�5A=�=335B�B�Brr)r,r-r.r/r0r6r�r�rdr�rerKrhrr1rrrr�r��sG����F�336�J�	337���	�	������K�!8��A�E�E��rr�c�2�\rSrSr%SrSr\\S'\\S'Sr	g)r�i�z$Holds an operator and an expression.)r�r�r�r�rN)338r,r-r.r/r0r6rfr�r�r1rrrr�r��s��.�
�F��G�339�Jrr�c��\rSrSrSrSrSrg)�Muli�z(Multiplies the left with the right node.rrN�r,r-r.r/r0rr1rrrr�r��s340��2��Hrr�c��\rSrSrSrSrSrg)�Divi�z#Divides the left by the right node.rrNr�rrrr�r��s341��-��Hrr�c��\rSrSrSrSrSrg)�FloorDivi�zZDivides the left by the right node and converts the342result into an integer by truncating.343r
rNr�rrrr�r��s����Hrr�c��\rSrSrSrSrSrg)�Addi�zAdd the left to the right node.rrNr�rrrr�r��s344��)��Hrr�c��\rSrSrSrSrSrg)�Subi�z&Subtract the right from the left node.rrNr�rrrr�r��s345��0��Hrr�c��\rSrSrSrSrSrg)�Modi�zLeft modulo right.rrNr�rrrr�r��s346����Hrr�c��\rSrSrSrSrSrg)�Powi�zLeft to the power of right.rrNr�rrrr�r��s347��%��Hrr�c�`�\rSrSrSrSrS	S\R\S\R4Sjjr348Srg)349�Andi�zShort circuited AND.�andNrrOc��[X5nURRU5=(a URRU5$r�rmrrrrs  rr�And.as_const�s5��#�D�3���y�y�!�!�(�+�M��350�351�0C�0C�H�0M�Mrrr�r,r-r.r/r0rrdrerKrhrr1rrrr�r��s3����H�N����K�!8�N�A�E�E�N�Nrr�c�`�\rSrSrSrSrS	S\R\S\R4Sjjr352Srg)353�Ori�zShort circuited OR.�orNrrOc��[X5nURRU5=(d URRU5$rr�rs  rr�Or.as_const�s5��#�D�3���y�y�!�!�(�+�L�t�z�z�/B�/B�8�/L�Lrrrr�rrrr�r��s3����H�M����K�!8�M�A�E�E�M�Mrr�c��\rSrSrSrSrSrg)�Noti�zNegate the expression.rrNr�rrrr�r��s354�� ��Hrr�c��\rSrSrSrSrSrg)�Negi�zMake the expression negative.rrNr�rrrr�r��s355��'��Hrr�c��\rSrSrSrSrSrg)�Posi�z8Make the expression positive (noop for most expressions)rrNr�rrrr�r��s356��B��Hrr�c�(�\rSrSr%SrSr\\S'Srg)�EnvironmentAttributeiz�Loads an attribute from the environment object.  This is useful for357extensions that want to call a callback stored on the environment.358r1rDrN�	r,r-r.r/r0r6rfr�r1rrrr�r�s����F�359
�Irr�c�2�\rSrSr%SrSr\\S'\\S'Srg)�ExtensionAttributeiz�Returns the attribute of an extension bound to the environment.360The identifier is the identifier of the :class:`Extension`.361 362This node is usually constructed by calling the363:meth:`~jinja2.ext.Extension.attr` method on an extension.364)�365identifierrDr�rDrNr�rrrr�r�s���$�F��O�366
�Irr�c�(�\rSrSr%SrSr\\S'Srg)�ImportedNameiaIf created with an import name the import name is returned on node367access.  For example ``ImportedName('cgi.escape')`` returns the `escape`368function from the cgi module on evaluation.  Imports are optimized by the369compiler so there is no need to assign them to local variables.370)�371importnamer�rNr�rrrr�r�s����F��Orr�c�2�\rSrSr%SrSr\\S'SSjrSr	g)	�InternalNamei)a"An internal name in the compiler.  You cannot create these nodes372yourself but the parser provides a373:meth:`~jinja2.parser.Parser.free_identifier` method that creates374a new identifier for you.  This identifier is not available from the375template and is not treated specially by the compiler.376r1rDNc��[S5e)NzKCan't create internal names.  Use the `free_identifier` method on a parser.�rur[s rrV�InternalName.__init__4s���
4�377�	378rr)rON)379r,r-r.r/r0r6rfr�rVr1rrrr�r�)s����F�380
�I�381rr�c�X�\rSrSr%SrSr\\S'S382S\R\383S\4SjjrS	r
g)�MarkSafei;z:Mark the wrapped expression as safe (wrap it as `Markup`).�r�r�NrrOc�`�[X5n[URRU55$r)rmrr�rrs  rr�MarkSafe.as_constAs&��#�D�3���d�i�i�(�(��2�3�3rrr)r,r-r.r/r0r6r�r�rdrerKrrr1rrrr�r�;s0��D�
�F�384�J�4����K�!8�4�F�4�4rr�c��\rSrSr%SrSr\\S'S385S\R\386S\R\\R44SjjrS	rg)�MarkSafeIfAutoescapeiFzuMark the wrapped expression as safe (wrap it as `Markup`) but387only if autoescaping is active.388 389.. versionadded:: 2.5390r�r�NrrOc���[X5nUR(a391[5eURR	U5nUR392(a[
U5$U$r)rmrTr)r�rrSr)rUrr�s   rr�MarkSafeIfAutoescape.as_constPsK��$�D�3������,���y�y�!�!�(�+������$�<���rrr)r,r-r.r/r0r6r�r�rdrerKr�rrhrr1rrrr�r�FsL����F�393�J�37�	��394�395�;�/�	�	396��������	�	�	rr�c��\rSrSrSrSrg)�ContextReferencei\a!Returns the current template context.  It can be used like a397:class:`Name` node, with a ``'load'`` ctx and will return the398current :class:`~jinja2.runtime.Context` object.399 400Here an example that assigns the current template name to a401variable named `foo`::402 403    Assign(Name('foo', ctx='store'),404           Getattr(ContextReference(), 'name'))405 406This is basically equivalent to using the407:func:`~jinja2.pass_context` decorator when using the high-level408API, which causes a reference to the context to be passed as the409first argument to a function.410rNr+rrrr�r�\s��rr�c��\rSrSrSrSrg)�DerivedContextReferenceinz�Return the current template context including locals. Behaves411exactly like :class:`ContextReference`, but includes local412variables, such as from a ``for`` loop.413 414.. versionadded:: 2.11415rNr+rrrr�r�ns��rr�c��\rSrSrSrSrg)�ContinueiwzContinue a loop.rNr+rrrr�r�ws��rr�c��\rSrSrSrSrg)�Breaki{z
Break a loop.rNr+rrrr�r�{s��rr�c�B�\rSrSr%SrSr\R\\	S'Sr416g)�ScopeizAn artificial scope.r�r�rNr�rrrr�r�s���
�F�417�&�&��,�rr�c�L�\rSrSr%SrSr\\S'\R\418\S'Srg)�OverlayScopei�a�An overlay scope for extensions.  This is a largely unoptimized scope419that however can be used to introduce completely arbitrary variables into420a sub scope from a dictionary or dictionary like object.  The `context`421field has to evaluate to a dictionary object.422 423Example usage::424 425    OverlayScope(context=self.call_method('get_context'),426                 body=[...])427 428.. versionadded:: 2.10429)r�r�r�r�rN)r,r-r.r/r0r6r�r�rdr�r	r1rrrrr�s!���!�F�
�M�430�&�&��,�rrc�B�\rSrSr%SrSr\R\\	S'Sr431g)�EvalContextModifieri�z�Modifies the eval context.  For each option that should be modified,432a :class:`Keyword` has to be added to the :attr:`options` list.433 434Example to change the `autoescape` setting::435 436    EvalContextModifier(options=[Keyword('autoescape', Const(True))])437)�optionsrrN)r,r-r.r/r0r6rdr�rir�r1rrrrr�s����F�
�V�V�G�_�rrc�B�\rSrSr%SrSr\R\\	S'Sr438g)�ScopedEvalContextModifieri�z�Modifies the eval context and reverts it later.  Works exactly like439:class:`EvalContextModifier` but will only modify the440:class:`~jinja2.nodes.EvalContext` for nodes in the :attr:`body`.441r�r�rNr�rrrrr�s���442�F�443�&�&��,�rrr�rvzte.NoReturnc��[S5e)Nzcan't create custom node typesr�)r�rvs  r�_failing_newr�s��444�4�4455�5r)zr0r�r�typingrd�collectionsr�446markupsafer�utilsr�
TYPE_CHECKING�typing_extensions�terMr�TypeVarr�mul�truediv�floordiv�pow�mod�add�subrr\rf�Callablerhr��not_�pos�negrrr r!�ger#�ler'rr)rAr3rKrermr	r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr447rr�rr%r�r5r9r;rGr�r�r]rirmr�ryrrr�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�r�r�rrrr�staticmethodrBrrr�<module>rs����448�������?�?�"�(�
�Y�Y�|�6�
2�449�450���	�	�	�451�452�453�454�,�,�	���	���	���B�����s�A�J�J����q�u�u�~�q�u�u�'<�=�=�>���=�=�	���	���:�
�q�v�v�c�1�:�:�q�u�u�g�q�u�u�n�5�5�6���+�+�455�+�+�456�+�+��K�K�457�+�+��K�K�458�
$�	B�����s�A�J�J����q�u�u�~�q�u�u�'<�=�=�>�	�C��C�1�t�1�""�"�.�6���459�460�;�(?��K��n�X�n�b�4���T���t���T���d���$��$���461�D�462�	��	��$��463�4�464��D���d���T�����$�t���T���$���4��.&�d�&�2&��&�0S�4�S�"�D���d��B�G�B�>�7���G��*:�7�:�>�7�>�J�6�J�	7�f�	7�-�t�-�,�465�'�'�-�466.��:;�*�*�[�:Q���W�W�Q�V�V�A�E�E�]�A�F�F�1�5�5�!�%�%�<�0�
0�1��*-&��-&�`3�
�3�"467��468�
!�4�
!� &�d�&�,&�d�&�,L�D�L�*469F�T�470F��d��8�f���'���'���w���'���'���'���'��N�'�N�M��M��)���)���)���4��471��472��4��473�4�474�$4�t�4��4��,�t��$�d���t���D���D���4��&475�$�476�� 3��6����6����6�=�6� ��-���r
codekingpro/portable-devtools · Team Ai