Files
intellecton/venv/lib/python3.12/site-packages/jinja2/__pycache__/nodes.cpython-312.pyc
T

423 lines
57 KiB
Plaintext
Raw Normal View History

Ë
LÀj‡ã
ó —UdZddlZddlZddlZddlmZddlmZddl m
Z
ejr
ddl Z
ddlmZej dd ¬
«Zej$ej&ej(ej*ej,ej.ej0d œZej4eej8ej:ej:gej:ffed <ej>ej@ejBd
œZ"ej4eej8ej:gej:ffed<ejFejHejJejLejNejPd„d„dœZ)ej4eej8ej:ej:gej:ffed<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«ZPdej¢d_d`ej^e.dej˜ejšej:ej4ej:ej:fffda„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ªej:d«ej:dd¬fd­„Zwexew«e-_y[wy)®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 úO/home/antigravity/intellecton/venv/lib/python3.12/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ó—eZdZdZy)Ú
Impossiblez8Raised if the node could not perform a requested action.N©Ú__name__Ú
__module__Ú __qualname__Ú__doc__rrrr)r)2s„ÚBrr)có—eZdZdZd„Zy)Ú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}|jt|r|dnt|d««|j|j|d««t |«dksJd«‚t |«t t |««k(sJd«‚t
|«||<Œ˜|jdd«tj||||«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¼&À$ÈÓ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ˆdŠGð
 %ð
� ‰ �Z Ô'Ü�|‰|˜C  u¨aÓ0Ð0rN)r+r,r-r.r>rrrr0r06s „ñ-ó 1rr0có—eZdZdZ d dddej
eddfd„Zdejeejffd„Z
d ejeejfddfd
„Z y) Ú EvalContextzcHolds evaluation time information. Custom attributes can be attached
to it in extensions.
NÚ environmentrÚ
template_nameÚreturncó¨—||_t|j«r|j|«|_d|_y|j|_d|_y©NF)rGÚcallableÚ
autoescapeÚvolatile)ÚselfrGrHs rÚ__init__zEvalContext.__init__LsK€ð'ˆÔÜ �K×*Ñ*Ô +Ø)×4Ñ4°]ÓCˆDŒOðˆ�
ð*×4Ñ4ˆDŒO؈�
rcó6—|jj«Sr)Ú__dict__Úcopy©rOs rÚsavezEvalContext.saveVs€Ø�}‰}×!Ñ!Ó#Ð#rÚoldcón—|jj«|jj|«yr)rRÚclearÚupdate)rOrVs rÚrevertzEvalContext.revertYs$€Ø �
‰
×ÑÔØ �
‰
×јSÕ!rr) r+r,r-r.ÚtÚOptionalÚstrrPÚMappingÚAnyrUrZrrrrFrFGst„ñð
LPñØ(ðØ9:¿¹ÀC¹ðà
óð$�a—i‘i  Q§U¡U 
Ñ+ó$ð"˜!Ÿ)™) C¨¯© JÑ/ð"°Dô"rrFÚnodeÚctxrIcób—|€,|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
ó¢—eZdZUdZdZej edfed<dZ ej edfed<dZ
e ed<ejd ed
<dejdejd d fd
„Z ddejejedejejed ej ej eejffd„Z ddejejedejejed ej dfd„Zdej&ed ejefd„Zdej,ej&eej ej&edffd ej efd„Zded dfd„Zdde ded dfd„Zd d„Zdejd efd„Zej<Zd efd„Zd efd„Z y )!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 óz—|jr td«‚|rÒt|«t|j«k7r†|js!tt |«j
›d�«‚tt |«j
›dt|j«›dt|j«dk7rd›�«‚d›�«‚t
|j|«D]\}}t|||«Œ|jD]}t|||j|d««Œ!|r tdtt|««›�«‚y) 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__�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ܘ˜d CÕ(ð
)à—O‘Oò <ˆDÜ �D˜$ 
§¡¨t°TÓ :Õ ;ð <á ÜÐ0´´d¸:Ó6FÓ1GÐ0JÐKÓLÐ Lð rÚexcludeÚonlyc#ó’K—|jD]%}|€|�|�||vs|€Œ||vsŒ |t||«f–—Œ'y#t$rYŒ4wxYw­w)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“sgèø€ð—K‘Kò ˆDà� T \ØÐ'¨D¸Ñ,?ØÑ$¨°ªðؤ¨¨dÓ 3Ð3Ó3ñ øô&òÙðüs*‚AŸA¥8µA¸ AÁAÁAÁAc#óÄK—|j||«D]G\}}t|t«r|D]}t|t«sŒ|–—ŒŒ3t|t«sŒD|–—ŒIy­w)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©saèø€ð×'Ñ'¨°Ó6ò ‰GˆAˆtܘ$¤Ô%Øò �AÜ! !¤TÕ*Ø›ñ ô˜D¤$Õ'Ø“
ñ
 ùs‚>A ÁA ÁA Ú node_typecó6—|j|«D]}|cSy)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ð ðrc#óŒK—|j«D]+}t||«r|–—|j|«Ed{–—†Œ-y7Œ­w)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ÃsFèø€ð ×*Ñ*Ó,ò 1ˆEܘ% Ô+Ø’ Ø—~‘~ iÓ0× 0Ñ 0ñ 1ð
1ús‚8AºA»Aracó°—t|g«}|rG|j«}d|jvr||_|j |j ««|rŒG|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ÎsQ€ô �d�V‹}ˆÙØ—<‘<“>ˆDؘŸ ™ Ñ#Ø�”Ø �K‰K˜×-Ñ-Ó/Ô 0ò ð
ˆ rÚoverridecóÌ—t|g«}|rU|j«}d|jvr|j�|r||_|j |j ««|rŒU|S)z.Set the line numbers of the node and children.rg)rr†r3rgr5r})rOrgr‰r‡r`s rÚ
set_linenozNode.set_linenoÜs[€ä�d�V‹}ˆÙØ—<‘<“>ˆDؘ4Ÿ?™?Ñ*Ø—;‘;Ð&©(Ø"(�D”KØ �K‰K˜×-Ñ-Ó/Ô 0ò ð ˆ rcó”—t|g«}|r9|j«}||_|j|j ««|rŒ9|S)z"Set the environment for all nodes.)rr†rGr5r})rOrGr‡r`s rÚset_environmentzNode.set_environmentçsD€ä�d�V‹}ˆÙØ—<‘<“>ˆDØ*ˆDÔ Ø �K‰K˜×-Ñ-Ó/Ô 0òðˆ rÚothercó —t|«t|«urtSt|j««t|j««k(Sr)r=ÚNotImplementedr;rv)rOrŽs rÚ__eq__z Node.__eq__ðs?€Ü �‹:œT %›[Ñ (Ü!Ð !ä�T×%Ñ%Ó'Ó(¬E°%×2CÑ2CÓ2EÓ,FÑFÐFrc󂇗djˆfd„‰jD««}t‰«j›d|›d�S)Nú, c3óB•K—|]}|›dt‰|d«›�–—Œy­w)ú=N)r6)Ú.0rrOs €rú <genexpr>z Node.__repr__.<locals>.<genexpr>ùs&øèø€ÒTÀ1 ˜s !¤G¨D°!°TÓ$:Ð#=Ô>ÑTùsƒú(ú))Újoinr2r=r+)rOÚargs_strs` rÚ__repr__z
Node.__repr__øs9ø€Ø—9‘9ÓTÈÏ É ÔTÓTˆÜ�t“*×%Ñ%Ð& a¨ z°Ð3Ð3rc󜇇—dtjttjfddfˆˆfd„ ŠgЉ|«dj ‰«S)Nr`rIcóT•—t|t«s‰jt|««y‰jdt |«j
›d�«|j s‰jd«yt|j «D]�\}}|r‰jd«t||«}t|t«rQ‰jd«t|«D] \}}|r‰jd«‰|«Œ"‰jd«Œ†‰|«Œ�‰jd«y)Nznodes.r˜r™r“ú[ú])
rxr ÚappendÚreprr=r+r2Ú enumerater6ry)r`ÚidxÚfieldÚvaluer{Ú_dumpÚbufs €€rr§zNode.dump.<locals>._dumpýsðø€Ü˜d¤DÔ)Ø—
‘
œ4 ›:Ô&Øà �J‰J˜¤ T£
× 3Ñ 3Ð4°AÐ6Ô 7Ø—;’;Ø—
‘
˜3”ØÜ'¨¯ © Ó4ò
!‘
��UÙØ—J‘J˜tÔ$Ü  eÓ,�ܘe¤TÔ*Ø—J‘J˜s”OÜ%.¨uÓ%5ò$™ ˜˜TÙØŸJ™J tÔ,Ù˜d� ð$ð—J‘J˜s•Oá˜%•Lð
!ð
�J‰J�s�Orrj)r[ÚUnionr r_rš)rOr§r¨s @@rÚdumpz Node.dumpüsCù€ð œŸ™¤¤a§e¡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‰G�C˜�HÑ Ó"Ø$=€J�—‘˜˜S˜Ñ!Ó=Ø€Hà ƒKØ—‘˜MÑ*Ó*ðM §¡ðM°Q·U±UðM¸tóMð(15Ø-1ñà—‘˜AŸK™K¨Ñ,Ñ-ðð�j‰j˜Ÿ™ SÑ)Ñ*ðð
�‰�A—G‘G˜C §¡˜JÑ'Ñ (ó ð015Ø-1ñà—‘˜AŸK™K¨Ñ,Ñ-ðð�j‰j˜Ÿ™ SÑ)Ñ*ðð
�‰�FÑ ó ð"˜aŸf™f ZÑ0ð°Q·Z±ZÀ
Ñ5Kóð 1ØŸ™ §¡¨
Ñ!3°Q·W±W¸Q¿V¹VÀJÑ=OÐQTÐ=TÑ5UÐ!UÑVð 1à
�‰�JÑ ó 1ð ˜3ð  6ó ñ  ð °ð Àó óðG˜AŸE™EðG dóGð �‰€Hð4˜#ó4ð�côr)Ú metaclasscó—eZdZdZdZy)ÚStmtzBase node for all statements.TN©r+r,r-r.r4rrrr¶r¶s
„Ù'à�Hrr¶có—eZdZdZdZy)ÚHelperz,Nodes that exist in a specific context only.TNr·rrrr¹r¹ s
„Ù6à�Hrr¹có:—eZdZUdZdZej eed<y)Ú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»&s…ñð€FØ
�&‰&�‰,Ôrr»có:—eZdZUdZdZej ded<y)Ú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Á/s…ñð€FØ �6‰6�&‰>ÔrrÁcó —eZdZUdZdZded<y)ÚExtendsz Represents an extends statement.)ÚtemplaterÄrÇN)r+r,r-r.r2r­rrrrÆrÆ8s…Ù*à
€FØÔrrÆcó —eZdZUdZdZeed<eed<ejeed<ejeed<ejeed<e
ed<y )
Ú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É?sI…ñðF€FØ ƒLØ
ƒJØ
�&‰&�‰,ÓØ �6‰6�$‰<ÓØ
�*‰*�TÑ
ÓØ„OrrÉcóŒ—eZdZUdZdZeed<ejeed<ejded<ejeed<y)Ú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ÏQs9…Ù>à
/€FØ
ƒJØ
�&‰&�‰,ÓØ �6‰6�$‰<ÓØ �6‰6�$‰<ÔrrÏcóŒ—eZdZUdZdZeed<ejded<ejded<eje ed<y )
Ú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Ò[s=…ñð
2€FØ
ƒIØ
�&‰&�‰.ÓØ�f‰f�V‰nÓØ
�&‰&�‰,ÔrrÒcóŒ—eZdZUdZdZded<ejded<ejded<ejeed <y
) Ú 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×hs=…ñð2€FØ
ƒLØ
�&‰&�‰.ÓØ�f‰f�V‰nÓØ
�&‰&�‰,Ôrr×cóD—eZdZUdZdZej eed<ded<y)Ú FilterBlockzNode for filter sections.)r½Úfilterr½ÚFilterrÜNr¾rrrrÛrÛts…Ù#à
€FØ
�&‰&�‰,ÓØ ÔrrÛcó‚—eZdZUdZdZej ded<ej ded<ej eed<y)Ú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ß|s8…ñð +€FØ
�V‰V�F‰^ÓØ
�F‰F�6‰NÓØ
�&‰&�‰,ÔrrßcóX—eZdZUdZdZeed<eje ed<e
ed<e
ed<y)Ú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ã‰s+…ñð 4€FØ
ƒIØ
�&‰&�‰,ÓØ ƒLØ„Nrrãcó4—eZdZUdZdZded<eed<eed<y)Ú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ç—s…Ù1à
;€FØÓØÓØÔrrçcó4—eZdZUdZdZded<eed<eed<y)Ú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à
3€FØÓØ ƒKØÔrrëcóŠ—eZdZUdZdZded<ejeje eje e ffed<e ed<y)Ú
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í©sD…ñ ð3€FØÓØ �6‰6�!—'‘'˜#˜qŸw™w s¨C xÑ0Ð0Ñ1Ñ 2Ó2ØÔrrícó —eZdZUdZdZeed<y)ÚExprStmtzAA statement that evaluates an expression and discards the result.©r`r`N)r+r,r-r.r2r r­rrrrðrð»s…ÙKà
€FØ
„Jrrðcó*—eZdZUdZdZded<eed<y)ÚAssignz"Assigns an expression to a target.)rÊr`rÄrÊr`N)r+r,r-r.r2r­r rrrróróÂs…Ù,à
€FØ ƒNØ
„Jrrócóh—eZdZUdZdZded<ejded<eje ed<y) Ú 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õÊs,…Ù&à
)€FØ ƒNØ
�J‰J�xÑ Ó Ø
�&‰&�‰,Ôrrõcó`—eZdZdZdZddej edejfd„Z de
fd„Z y) 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Ðrcó—y)z8Check if it's possible to assign something to this node.FrrTs rÚ
can_assignzExpr.can_assignås€àrr) r+r,r-r.r4r[r\rFr_rúr²rürrrrÄrÄÓs6„Ù(à€Hñ  §¡¨KÑ!8ð ÀAÇEÁEó ð˜DôrrÄcóx—eZdZUdZdZeed<eed<eed<dZd de je d e jfd
„Z
y) ÚBinExprz%Baseclass for all binary expressions.)ÚleftÚrightrÿrÚoperatorTNr÷rIcót—t||«}|jjr,|j|jjvr
t «‚t |j} ||jj|«|jj|««S#t$r}t «|‚d}~wwxYwr) rdrGÚ sandboxedrÚintercepted_binopsr)rrÿrúrÚ Exception©rOr÷ÚfÚes rrúzBinExpr.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 B7Â' B2Â2B7r©r+r,r-r.r2rÄr­r]r4r[r\rFr_rúrrrrþrþês>…Ù/à
€FØ
ƒJØ ƒK؃MØ€Hñ
& §¡¨KÑ!8ð
&ÀAÇEÁEô
&rrþcón—eZdZUdZdZeed<eed<dZd
de je de jfd „Z
y) Ú UnaryExprz$Baseclass for all unary expressions.rñr`rTNr÷rIcó@—t||«}|jjr,|j|jjvr
t «‚t |j} ||jj|««S#t$r}t «|‚d}~wwxYwr)
rdrGrrÚintercepted_unopsr)rr`rúrrs rrúzUnaryExpr.as_const s†€Ü# D¨(Ó3ˆð
× Ñ × *Ò *Ø—
‘
 ×!5Ñ!5×!GÑ!GÑGä“,Ð Ü ˜$Ÿ-™-Ñ (ˆð &Ù�T—Y‘Y×'Ñ'¨Ó1Ó2Ð 2øÜò &Ü“, AÐ %ûð &úsÁ# B BÂ
BÂBrr rrrr r s9…Ù.à
€FØ
ƒJ؃MØ€Hñ
& §¡¨KÑ!8ð
&ÀAÇEÁEô
&rr có6—eZdZUdZdZeed<eed<defd„Zy)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‰yÐ RÐRÐRrN© r+r,r-r.r2r]r­r²rürrrrÕrÕs&…ñð€FØ
ƒIØ ƒHðS˜DôSrrÕcó6—eZdZUdZdZeed<eed<defd„Zy)ÚNSRefz)Reference to a namespace value assignment)r@rCr@rCrIcó—y)NTrrTs rrüzNSRef.can_assign3s€ð
rNrrrrrr,s …Ù3à
€FØ
ƒIØ
ƒIð˜Dôrrcó—eZdZdZdZy)ÚLiteralzBaseclass for literals.TNr·rrrrr;s
„Ù!à�Hrrc
óÊ—eZdZUdZdZej ed<d deje dej fd„Z
e d
dej deje d d
ddfd „«Z
y)Ú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‰zÐrrgrGzt.Optional[Environment]cóH—ddlm}||«s
t«‚||||¬«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_untrustedNs&€õ ,á˜UÔ#Ü“,Ð Ù�5 °[ÔAÐArrr«)r+r,r-r.r2r[r_r­r\rFrúÚ classmethodr®r%rrrrrAs‹…ñð €FØ �5‰5ƒLñ §¡¨KÑ!8ðÀAÇEÁEóðð#'Ø15ñ Bà�u‰uðBð—
‘
˜3‘ðBð/ð Bð
ò BóñBrrcóL—eZdZUdZdZeed<ddeje defd„Z
y) Ú TemplateDatazA constant template string.)Údatar)Nr÷rIcó —t||«}|jr
t«‚|jrt |j
«S|j
Sr)rdrNr)rMrr)rùs rrúzTemplateData.as_constfsA€Ü# D¨(Ó3ˆØ × Ò Ü“,Ð Ø × Ò Ü˜$Ÿ)™)Ó$Ð $Ø�y‰yÐrr) r+r,r-r.r2r]r­r[r\rFrúrrrr(r(`s+…Ù%à
€FØ
ƒIñ §¡¨KÑ!8ðÀCôrr(có®—eZdZUdZdZej eed<e ed<d deje dejejdffd „Zdefd
„Zy) 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óX‡—t|‰«Štˆfd„|jD««S)Nc3ó@•K—|]}|j‰«–—Œy­wr©rú©r–Úxr÷s €rr—z!Tuple.as_const.<locals>.<genexpr>{søèø€Ò>¨a�Q—Z‘Z ×)Ñ>ùóƒ)rdr;r,rùs `rrúzTuple.as_constys$ø€Ü# D¨(Ó3ˆÜÓ>°4·:±:Ô>Ó>Ð>rcóJ—|jD]}|j«rŒyy)NFT)r,rü)rOr{s rrüzTuple.can_assign}s'€Ø—J‘Jò ˆDØ—?‘?Õ$Ùð ðrr)r+r,r-r.r2r[r¿rÄr­r]r\rFr¬r_rúr²rürrrr¬r¬os[…ñð
€FØ �6‰6�$‰<ÓØ ƒHñ? §¡¨KÑ!8ð?ÀAÇGÁGÈAÏEÉEÐSVÈJÑDWó?ð˜Dôrr¬có”—eZdZUdZdZej eed<ddeje
dej ejfd„Z y) r¿z&Any list literal such as ``[1, 2, 3]``©r,r,Nr÷rIcóv—t||«}|jD�cgc]}|j|«‘Œc}Scc}wr)rdr,rú)rOr÷r1s rrúz
List.as_constŠs/€Ü# D¨(Ó3ˆØ.2¯j©jÖ9¨�—
‘
˜8Õ$Ò9Ð9ùÒ9s›6r)
r+r,r-r.r2r[r¿rÄr­r\rFr_rúrrrr¿r¿„s@…Ù0à
€FØ �6‰6�$‰<Óñ: §¡¨KÑ!8ð:ÀAÇFÁFÈ1Ï5É5ÁMô:rr¿có®—eZdZUdZdZej ded< d deje dejejejffd„Z y)
ÚDictzeAny dict literal such as ``{1: 2, 3: 4}``. The items must be a list of
:class:`Pair` nodes.
r5ÚPairr,Nr÷rIcóX‡—t|‰«Štˆfd„|jD««S)Nc3ó@•K—|]}|j‰«–—Œy­wrr/r0s €rr—z Dict.as_const.<locals>.<genexpr>›søèø€Ò=¨Q�A—J‘J˜x×(Ñ=ùr2)rdÚdictr,rùs `rrúz
Dict.as_const—s&ø€ô$ D¨(Ó3ˆÜÓ=°$·*±*Ô=Ó=Ð=rr)
r+r,r-r.r2r[r¿r­r\rFr8r_rúrrrr8r8�sT…ñð€FØ �6‰6�&‰>Óð37ñ>ØŸ
™
 ;Ñ/ð>à
�‰�—‘�q—u‘u� Ñ ô>rr8cóž—eZdZUdZdZeed<eed< d deje dejejejffd„Z y)
r9zA key, value pair for dicts.©Úkeyr¦r?r¦Nr÷rIcó†—t||«}|jj|«|jj|«fSr)rdr?rúr¦rùs rrúz
Pair.as_const¥s9€ô$ D¨(Ó3ˆØ�x‰x× Ñ  Ó*¨D¯J©J×,?Ñ,?ÀÓ,IÐIÐIrr)
r+r,r-r.r2rÄr­r[r\rFr¬r_rúrrrr9r9žsO…Ù&à
€FØ
ƒIØ ƒKð37ñJØŸ
™
 ;Ñ/ðJà
�‰�—‘˜Ÿ™�Ñ ôJrr9cóˆ—eZdZUdZdZeed<eed<d deje
dejeejffd„Z
y)
ÚKeywordz>A key, value pair for keyword arguments where key is a string.r>r?r¦Nr÷rIcóh—t||«}|j|jj|«fSr)rdr?r¦rúrùs rrúzKeyword.as_const³s,€Ü# D¨(Ó3ˆØ�x‰x˜Ÿ™×,Ñ,¨XÓ6Ð6Ð6rr)r+r,r-r.r2r]r­rÄr[r\rFr¬r_rúrrrrBrB¬sD…ÙHà
€FØ ƒHØ ƒKñ7 §¡¨KÑ!8ð7ÀAÇGÁGÈCÐQR×QVÑQVÈJÑDWô7rrBcóŽ—eZdZUdZdZeed<eed<ejeed<d
deje dejfd „Z y) ÚCondExprzZA conditional expression (inline if expression). (``{{
foo if bar else baz }}``)
)rÌÚexpr1Úexpr2rÌrFrGNr÷rIcóè—t||«}|jj|«r|jj|«S|j€
t «‚|jj|«Sr)rdrÌrúrFrGr)rùs rrúzCondExpr.as_constÂs^€Ü# D¨(Ó3ˆØ �9‰9× Ñ ˜hÔ 'Ø—:‘:×&Ñ& xÓ0Ð 0ð �:‰:Ð Ü“,Ð à�z‰z×"Ñ" 8Ó,Ð,rr) r+r,r-r.r2rÄr­r[r\rFr_rúrrrrErE¸sG…ñð(€FØ
ƒJØ ƒKØ �:‰:�dÑ Óñ - §¡¨KÑ!8ð -ÀAÇEÁEô -rrE)Ú_FilterTestCommonrÙr÷cóö‡—|jD�cgc]}|j‰«‘Œ}}tˆfd„|jD««}|j�+ |j |jj‰««|j�/ |j|jj‰««||fS||fScc}w#t $r}t«|‚d}~wwxYw#t $r}t«|‚d}~wwxYw)Nc3ó@•K—|]}|j‰«–—Œy­wrr/r0s €rr—z args_as_const.<locals>.<genexpr>Òsøèø€Ò<¨1�!—*‘*˜X×&Ñ<ùr2)
rÓrúr<ÚkwargsÚdyn_argsr5rr)Ú
dyn_kwargsrY)r`r÷r1rÓrLrs ` rÚ
args_as_constrOÎsàø€ð+/¯)©)Ö 4 QˆA�J‰J�xÕ Ð 4€DÐ 4Ü
Ó<°· ± Ô<Ó
<€Fà ‡}�}Ð ð &Ø �K‰K˜Ÿ
™
×.Ñ.¨xÓ8Ô 9ð ‡�Ð"ð &Ø �M‰M˜$Ÿ/™/×2Ñ2°8Ó<Ô =ð �ˆ<Ј4�ˆ<Ðùò 5øô ò &Ü“, AÐ %ûð &ûô ò &Ü“, AÐ %ûð &ús5�B>Á*C *Cà Cà CÃCà C8Ã( C3Ã3C8cóþ—eZdZUdZeed<eed<ejeed<eje ed<ejeed<ejeed<dZ dZ d
d
eje
d ejfd „Zy )rI)r`r@rÓrLrMrNr`r@rÓrLrMrNTNr÷rIcó@—t||«}|jr
t«‚|jr|jj
}n|jj }|j|j«}tj|«}|�|tjur
t«‚|jjr.t|dd«dustj|«r
t«‚t!||«\}}|j#d|j$j'|««|tj(ur|j#d|«n.|tjur|j#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ÚiscoroutinefunctionrOÚinsertr`rúÚ eval_contextr)rOr÷Úenv_mapÚfuncÚpass_argrÓrLrs rrúz_FilterTestCommon.as_constîsU€Ü# D¨(Ó3ˆà × Ò Ü“,Ð à �?Š?Ø×*Ñ*×2Ñ2‰Gà×*Ñ*×0Ñ0ˆGà�{‰{˜4Ÿ9™9Ó%ˆÜ×$Ñ$ TÓ*ˆà ˆ<˜8¤x×'7Ñ'7Ñ7Ü“,Ð à × Ñ × (Ò (Ü �DÐ/°Ó 7¸4Ñ ?Ü×*Ñ*¨4Ô0ä“,Ð ä$ T¨8Ó4‰ ˆˆfØ � ‰ �A�t—y‘y×)Ñ)¨(Ó3Ô4à ”x×,Ñ,Ñ ,Ø �K‰K˜˜8Õ $Ø
œ×-Ñ-Ñ
-Ø �K‰K˜˜8×/Ñ/Ô 0ð &Ù˜Ð( Ñ(Ð (øÜò &Ü“, AÐ %ûð &úsÅ<FÆ FÆ
FÆFr)r+r,r-r2rÄr­r]r[r¿r9r\r4rSrFr_rúrrrrIrIãsu…Ø
I€FØ
ƒJØ
ƒIØ
�&‰&�‰,ÓØ
�F‰F�4‰LÓØ�j‰j˜ÑÓØ—
‘
˜4Ñ Ó Ø€HØ€Jñ"& §¡¨KÑ!8ð"&ÀAÇEÁEô"&rrIc󂇗eZdZUdZej
eed<ddej
edejfˆ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`r÷rIcóP•—|j€
t«‚t‰|�
|¬«S)N)r÷)r`r)Úsuperrú)rOr÷Ú __class__s €rrúzFilter.as_consts(ø€Ø �9‰9Ð Ü“,Ð ä‰wѨÐÓ2Ð2rr) r+r,r-r.r[r\rÄr­rFr_rúÚ
__classcell__)rcs@rrÝrÝs>ø…ñð �*‰*�TÑ
Óñ3 §¡¨KÑ!8ð3ÀAÇEÁE÷3ñ3rrÝcó—eZdZdZdZy)Ú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.rSrrrrfrf$s„ñð�Jrrfcó°—eZdZUdZdZeed<ejeed<eje ed<ejeed<ejeed<y) 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ÓrLrMrNr`rÓrLrMrNN) r+r,r-r.r2rÄr­r[r¿rBr\rrrrÙrÙ1sN…ñðB€FØ
ƒJØ
�&‰&�‰,ÓØ
�F‰F�7‰OÓØ�j‰j˜ÑÓØ—
‘
˜4Ñ Ô rrÙcót—eZdZUdZdZeed<eed<eed<d
deje
dejfd „Z y) ÚGetitemz@Get an attribute or item from an expression and prefer the item.)r`rqrar`rqraNr÷rIcó"—|jdk7r
t«‚t||«} |jj |j
j
|«|jj
|««S#t$r}t«|‚d}~wwxYw©NÚload) rar)rdrGÚgetitemr`rúrqr©rOr÷rs rrúzGetitem.as_constIs€Ø �8‰8�vÒ Ü“,Ð ä# D¨(Ó3ˆð &Ø×'Ñ'×/Ñ/Ø— ‘ ×"Ñ" 8Ó,¨d¯h©h×.?Ñ.?ÀÓ.Ióð
øôò &Ü“, AÐ %ûð &ús§A
A5Á5 BÁ> B Â Br©
r+r,r-r.r2rÄr­r]r[r\rFr_rúrrrririAs9…ÙJà
#€FØ
ƒJØ
ƒIØ ƒHñ & §¡¨KÑ!8ð &ÀAÇEÁEô &rricót—eZdZUdZdZeed<eed<eed<d
deje
dejfd „Z y) ÚGetattrznGet an attribute or item from an expression that is a ascii-only
bytestring and prefer the attribute.
)r`rCrar`rCraNr÷rIcó—|jdk7r
t«‚t||«} |jj |j
j
|«|j«S#t$r}t«|‚d}~wwxYwrk) rar)rdrGr6r`rúrCrrns rrúzGetattr.as_constasm€Ø �8‰8�vÒ Ü“,Ð ä# D¨(Ó3ˆð &Ø×'Ñ'×/Ñ/°· ± ×0BÑ0BÀ8Ó0LÈdÏiÉiÓXÐ XøÜò &Ü“, AÐ %ûð &ús§>A&Á& A?Á/ A:Á:A?rrorrrrqrqWs=…ñð%€FØ
ƒJØ
ƒIØ ƒHñ & §¡¨KÑ!8ð &ÀAÇEÁEô &rrqcó®—eZdZUdZdZej eed<ej eed<ej eed<d
dej e de
fd „Z y) ÚSlicez_Represents a slice object. This must only be used as argument for
:class:`Subscript`.
)ÚstartÚstopÚsteprurvrwNr÷rIcó‡—t|‰«Šdtjtdtjtjfˆfd„ }t ||j «||j«||j««S)NÚobjrIcó,•—|€y|j‰«Srr/)ryr÷s €rÚconstzSlice.as_const.<locals>.constzsø€Øˆ{ØØ—<‘< Ó)Ð )r) rdr[r\rÄr_Úslicerurvrw)rOr÷r{s ` rrúzSlice.as_constwsdø€Ü# D¨(Ó3ˆð *”q—z‘z¤$Ñ'ð *¬A¯J©J´q·u±uÑ,=õ *ô
‘U˜4Ÿ:™:Ó&©¨d¯i©iÓ(8¹%ÀÇ Á Ó:JÓKÐKrr) r+r,r-r.r2r[r\rÄr­rFr|rúrrrrtrtmsZ…ñð'€FØ �:‰:�dÑ ÓØ
�*‰*�TÑ
ÓØ
�*‰*�TÑ
ÓñL §¡¨KÑ!8ðLÀEôLrrtcóf—eZdZUdZdZej eed<ddeje
de fd„Z y) ÚConcatzXConcatenates the list of expressions provided after converting
them to strings.
rÂrÃNr÷rIcód‡—t|‰«Šdjˆfd„|jD««S)Nrjc3óR•K—|]}t|j‰««–—Œ y­wr)r]rúr0s €rr—z"Concat.as_const.<locals>.<genexpr>Œsøèø€ÒE°Q”s˜1Ÿ:™: hÓ/×0ÑEùsƒ$')rdršrÃrùs `rrúzConcat.as_constŠs(ø€Ü# D¨(Ó3ˆØ�w‰wÓE¸$¿*¹*ÔEÓEÐErr)
r+r,r-r.r2r[r¿rÄr­r\rFr]rúrrrr~r~‚s;…ñð€FØ �6‰6�$‰<ÓñF §¡¨KÑ!8ðFÀCôFrr~có„—eZdZUdZdZeed<ejded<d
deje
dejfd „Z y) ÚCompareziCompares an expression with some other expressions. `ops` must be a
list of :class:`Operand`\s.
)ÚexprÚopsrƒÚOperandr„Nr÷rIcó*—t||«}|jj|«x}} |jD]<}|jj|«}t |j
||«}|sy|}Œ> |S#t $r}t«|‚d}~wwxYwrK)rdrƒrúr„r'Úoprr))rOr÷r�r¦r‡Ú new_valuers rrúzCompare.as_const˜s–€Ü# D¨(Ó3ˆØŸ™×+Ñ+¨HÓ5Ð5ˆ�ð
&Ø—h‘hò
"�ØŸG™G×,Ñ,¨XÓ6� Ü'¨¯©Ñ.¨u°iÓ@�áÙ à!‘ñ
"ðˆ
øôò &Ü“, AÐ %ûð &ús«AA9Á2A9Á9 BÂ B
Â
Br)
r+r,r-r.r2rÄr­r[r¿r\rFr_rúrrrr‚r‚�sB…ñð€FØ
ƒJØ
�‰� Ñ Óñ §¡¨KÑ!8ðÀAÇEÁEôrr‚có*—eZdZUdZdZeed<eed<y)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Ø
„Jrr…có—eZdZdZdZy)ÚMulz(Multiplies the left with the right node.r N©r+r,r-r.rrrrr‹r‹³s
„Ù2à�Hrr‹có—eZdZdZdZy)ÚDivz#Divides the left by the right node.r NrŒrrrrŽr޹s
„Ù-à�HrrŽcó—eZdZdZdZy)ÚFloorDivzbDivides the left by the right node and converts the
result into an integer by truncating.
r
NrŒrrrr�r�¿s„ñð�Hrr�có—eZdZdZdZy)ÚAddzAdd the left to the right node.rNrŒrrrr’r’Çs
„Ù)à�Hrr’có—eZdZdZdZy)ÚSubz&Subtract the right from the left node.rNrŒrrrr”r”Ís
„Ù0à�Hrr”có—eZdZdZdZy)ÚModzLeft modulo right.rNrŒrrrr–r–Ós
„Ùà�Hrr–có—eZdZdZdZy)ÚPowzLeft to the power of right.rNrŒrrrr˜r˜Ùs
„Ù%à�Hrr˜cóT—eZdZdZdZddej edejfd„Z y)ÚAndzShort circuited AND.ÚandNr÷rIcóŠ—t||«}|jj|«xr|jj|«Sr©rdrÿrúrrùs rrúz And.as_constäs7€Ü# D¨(Ó3ˆØ�y‰y×!Ñ! (Ó+ÒM°·
±
×0CÑ0CÀHÓ0MÐMrr©
r+r,r-r.rr[r\rFr_rúrrrršršßs-„Ùà€HñN §¡¨KÑ!8ðNÀAÇEÁEôNrršcóT—eZdZdZdZddej edejfd„Z y)ÚOrzShort circuited OR.ÚorNr÷rIcóŠ—t||«}|jj|«xs|jj|«Srr�rùs rrúz Or.as_constîs7€Ü# D¨(Ó3ˆØ�y‰y×!Ñ! (Ó+ÒL¨t¯z©z×/BÑ/BÀ8Ó/LÐLrrržrrrr r és-„Ùà€HñM §¡¨KÑ!8ðMÀAÇEÁEôMrr có—eZdZdZdZy)ÚNotzNegate the expression.rNrŒrrrr¤r¤ós
„Ù à�Hrr¤có—eZdZdZdZy)ÚNegzMake the expression negative.rNrŒrrrr¦r¦ùs
„Ù'à�Hrr¦có—eZdZdZdZy)ÚPosz8Make the expression positive (noop for most expressions)rNrŒrrrr¨r¨ÿs
„ÙBà�Hrr¨có —eZdZUdZdZeed<y)ÚEnvironmentAttributez�Loads an attribute from the environment object. This is useful for