f 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<ejFejHejJejLejNejPdddZ)ej4eej8ej:ej:gej:ffed<Gdde*Z+Gdde,Z-GddZ.dd dej^e.de.fdZ0Gdd e-Z1Gdd e1Z2Gd!d"e1Z3Gd#d$e1Z4Gd%d&e2Z5Gd'd(e2Z6Gd)d*e2Z7Gd+d,e2Z8Gd-d.e2Z9Gd/d0e2Z:Gd1d2e2Z;Gd3d4e2Z<Gd5d6e2Z=Gd7d8e2Z>Gd9d:e2Z?Gd;de2ZAGd?d@e2ZBGdAdBe2ZCGdCdDe1ZDGdEdFeDZEGdGdHeDZFGdIdJeDZGGdKdLeDZHGdMdNeDZIGdOdPeIZJGdQdReIZKGdSdTeIZLGdUdVeIZMGdWdXeIZGdYdZe3ZNGd[d\e3ZOGd]d^eDZPdejd_d`ej^e.dejejej:ej4ej:ej:fffdaZRGdbdceDZSGdddeeSZTGdfdgeSZUGdhdieDZVGdjdkeDZWGdldmeDZXGdndoeDZYGdpdqeDZZGdrdseDZ[Gdtdue3Z\GdvdweEZ]GdxdyeEZ^Gdzd{eEZ_Gd|d}eEZ`Gd~deEZaGddeEZbGddeEZcGddeEZdGddeEZeGddeFZfGddeFZgGddeFZhGddeDZiGddeDZjGddeDZkGddeDZlGddeDZmGddeDZnGddeDZoGddeDZpGdde2ZqGdde2ZrGdde2ZsGdde2ZtGdde2ZuGddeuZvdej:dej:ddfdZwexewe-_y[wy)zAST 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 _NodeBoundNode)bound)*///**%+-_binop_to_func)notrr _uaop_to_funcc ||vSNabs U/var/lib/jenkins/workspace/mettalog/venv/lib/python3.12/site-packages/jinja2/nodes.pyr-sqAvc ||vSrrrs rrr.s!1*r)eqnegtgteqltlteqinnotin_cmpop_to_funcceZdZdZy) Impossiblez8Raised if the node could not perform a requested action.N__name__ __module__ __qualname____doc__rrrr)r)2sBrr)ceZdZdZdZy)NodeTypezA metaclass for nodes that handles the field and attribute inheritance. fields and attributes from the parent class are automatically forwarded to the child.cdD]}g}|jt|r|dnt|d|j|j|dt |dksJdt |t t |k(sJdt |||<|jddtj||||S) N)fields attributesrrrz multiple inheritance not allowedzlayout conflictabstractF) extendgetattrobjectgetlensettuple setdefaulttype__new__)mcsnamebasesdattrstorages rr>zNodeType.__new__;s*D13G NN7u58&$K L NN155r? +u:? F$F F?w<3s7|#44 G6G G4GnAdG + Z'||Cua00rN)r+r,r-r.r>rrrr0r06s - 1rr0ceZdZdZ d dddej eddfdZdejeejffdZ d ejeejfddfd Z y) EvalContextzcHolds evaluation time information. Custom attributes can be attached to it in extensions. N environmentr template_namereturnc||_t|jr|j||_d|_y|j|_d|_yNF)rGcallable autoescapevolatile)selfrGrHs r__init__zEvalContext.__init__LsK' K** +)44]CDO *44DO rc6|jjSr)__dict__copyrOs rsavezEvalContext.saveVs}}!!##roldcn|jj|jj|yr)rRclearupdate)rOrVs rrevertzEvalContext.revertYs$  S!rr) r+r,r-r.tOptionalstrrPMappingAnyrUrZrrrrFrFGst LP(9:C $aiiQUU +$"!))CJ/"D"rrFnodectxrIcb|,|j tdt|jS|S)NzIif no eval context is passed, the node must have an attached environment.)rG RuntimeErrorrF)r`ras rget_eval_contextrd^s= {    #) 4++,, Jrc eZdZUdZdZej edfed<dZ ej edfed<dZ e ed<ejd ed <dejdejd d fd Z ddejejedejejed ej ej eejffdZ ddejejedejejed ej dfdZdej&ed ejefdZdej,ej&eej ej&edffd ej efdZded dfdZdde ded dfdZd dZdejd efdZej<Zd efdZd efdZ y )!r aBaseclass 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.r2linenorGr3TrgrrGrINc z|jr td|rt|t|jk7r|js!tt |j dtt |j dt|jdt|jdk7rddt |j|D]\}}t||||jD]}t|||j|d!|r tdtt|y) Nz#abstract nodes are not instantiablez takes 0 argumentsz takes 0 or z argumentrszunknown attribute ) r4 TypeErrorr9r2r=r+zipsetattrr3popnextiter)rOr2r3r@argrCs rrPz Node.__init__s% ==AB B 6{c$++..{{#tDz':':&==O$PQQDz**-\#dkk:J9Ks4;;'71'<EGBDEG!f5 cdC(6OOD D$ tT : ;$ 0d:6F1G0JKL L rexcludeonlyc#K|jD]%}|||||vs|||vs |t||f'y#t$rY4wxYww)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)r2r6AttributeError)rOrrrsr@s r iter_fieldszNode.iter_fieldssbKKDT\'D,?$d 333 &s*AA8A AAAAc#K|j||D]G\}}t|tr|D]}t|ts|3t|tsD|Iyw)zIterates 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 isinstancelistr )rOrrrs_itemns riter_child_nodeszNode.iter_child_nodessW''6GAt$%A!!T*D$' 7s>A A A  node_typec6|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 rfindz Node.finds!mmI.FM/rc#K|jD]+}t||r||j|Ed{-y7w)zFind 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 rrz Node.find_allsA **,E%+ ~~i0 0 0- 1s8AAAract|g}|rG|j}d|jvr||_|j |j |rG|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)rpopleftr2rar5r})rOratodor`s rset_ctxz Node.set_ctxsQ dV}<<>D # KK--/ 0   roverridect|g}|rU|j}d|jvr|j|r||_|j |j |rU|S)z.Set the line numbers of the node and children.rg)rrr3rgr5r})rOrgrrr`s r set_linenozNode.set_linenos[dV}<<>D4??*;;&("(DK KK--/ 0   rct|g}|r9|j}||_|j|j |r9|S)z"Set the environment for all nodes.)rrrGr5r})rOrGrr`s rset_environmentzNode.set_environmentsDdV}<<>D*D  KK--/ 0 rotherct|t|urtSt|jt|jk(Sr)r=NotImplementedr;rv)rOrs r__eq__z Node.__eq__s? :T%[ (! !T%%'(E%2C2C2E,FFFrcdjfdjD}tjd|dS)N, c3BK|]}|dt|dyw)=N)r6).0rrOs r z Node.__repr__..s&T1s!GD!T$:#=>Ts())joinr2r=r+)rOargs_strs` r__repr__z Node.__repr__s999T TTt*%%&az33rcdtjttjfddffd g|dj S)Nr`rIcTt|tsjt|yjdt |j d|j sjdyt|j D]\}}|rjdt||}t|trQjdt|D] \}}|rjd|"jd|jdy)Nznodes.rrr[]) rxr appendreprr=r+r2 enumerater6ry)r`idxfieldvaluer{_dumpbufs rrzNode.dump.._dumpsdD) 4:& JJT 3 34A6 7;; 3' 4 UJJt$e,eT*JJsO%.u%5 TJJt,d &6JJsO%L5 JJsOrrj)r[Unionr r_r)rOrrs @@rdumpz Node.dumpsC aee ,  0 d wws|rNN)F)rGrrIr )!r+r,r-r.r2r[Tupler]__annotations__r3r4intr\r_rP ContainerIteratorrvr}Typerrrrrboolrrrr7__hash__rrrrrr r is !#FAGGCH "$=JS!=H KM**MMQUUMtM(15-1AKK,-jjS)* AGGCJ' ( 015-1AKK,-jjS)* F  "affZ0QZZ 5K 1 !3QWWQVVJ=OQT=T5U!UV 1 J  1 3 6     GAEEGdG H4#4cr) metaclassceZdZdZdZy)StmtzBase node for all statements.TNr+r,r-r.r4rrrrrs 'HrrceZdZdZdZy)Helperz,Nodes that exist in a specific context only.TNrrrrrr s 6Hrrc:eZdZUdZdZej eed<y)TemplatezjNode that represents a template. This must be the outermost node that is passed to the compiler. bodyrN r+r,r-r.r2r[Listr rrrrrr&sF &&,rrc:eZdZUdZdZej ded<y)OutputzA node that holds multiple expressions which are then printed out. This is used both for the `print` statement and the regular template data. nodesExprrN)r+r,r-r.r2r[rrrrrrr/sF 66&>rrc eZdZUdZdZded<y)Extendsz Represents an extends statement.)templaterrN)r+r,r-r.r2rrrrrr8s* FrrceZdZUdZdZeed<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`. )targetrprelse_test recursiverrprrrrN) r+r,r-r.r2r rr[rr\rrrrrr?sIFF L J &&, 66$< **T OrrceZdZUdZdZeed<ejeed<ejded<ejeed<y)Ifz4If `test` is true, `body` is rendered, else `else_`.)rrelif_rrrrrN) r+r,r-r.r2r rr[rrrrrrQs9> /F J &&, 66$< 66$<rrceZdZUdZdZeed<ejded<ejded<eje ed<y ) MacrozA 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@argsdefaultsrr@NamerrrrN) r+r,r-r.r2r]rr[rr rrrrr[s= 2F I &&.ffVn &&,rrceZdZUdZdZded<ejded<ejded<ejeed <y ) CallBlockzLike a macro without a name but a call instead. `call` is called with the unnamed macro as `caller` argument this node holds. )callrrrCallrrrrrrN) r+r,r-r.r2rr[rr rrrrrhs=2F L &&.ffVn &&,rrcDeZdZUdZdZej eed<ded<y) FilterBlockzNode for filter sections.)rfilterrFilterrNrrrrrrts# F &&, rrceZdZUdZdZej ded<ej ded<ej eed<y)WithzSpecific 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 )targetsvaluesrrrrrN) r+r,r-r.r2r[rrr rrrrr|s8 +F VVF^ FF6N &&,rrcXeZdZUdZdZeed<eje ed<e ed<e ed<y)BlockzkA node that represents a block. .. versionchanged:: 3.0.0 the `required` field was added. )r@rscopedrequiredr@rrrN) r+r,r-r.r2r]rr[rr rrrrrrs+ 4F I &&, LNrrc4eZdZUdZdZded<eed<eed<y)Includez'A node that represents the include tag.)r with_contextignore_missingrrrrN)r+r,r-r.r2rrrrrrrs1 ;Frrc4eZdZUdZdZded<eed<eed<y)Importz&A node that represents the import tag.)rrrrrrrN)r+r,r-r.r2rr]rrrrrrs0 3F KrrceZdZUdZdZded<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. )rnamesrrrrrN) r+r,r-r.r2rr[rrr]rrrrrrrsD 3F 66!''#qwwsCx001 22rrc eZdZUdZdZeed<y)ExprStmtzAA statement that evaluates an expression and discards the result.r`r`N)r+r,r-r.r2r rrrrrrsK F Jrrc*eZdZUdZdZded<eed<y)Assignz"Assigns an expression to a target.)rr`rrr`N)r+r,r-r.r2rr rrrrrs, F N JrrcheZdZUdZdZded<ejded<eje ed<y) AssignBlockzAssigns a block to a target.)rrrrrrrrN) r+r,r-r.r2rr[r\rr rrrrrs,& )F N JJx  &&,rrc`eZdZdZdZddej edejfdZ de fdZ y) rzBaseclass for all expressions.TNeval_ctxrIct)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)rOrs ras_constz Expr.as_consts lrcy)z8Check if it's possible to assign something to this node.FrrTs r can_assignzExpr.can_assignsrr) r+r,r-r.r4r[r\rFr_rrrrrrrrs6(H K!8 AEE DrrcxeZdZUdZdZeed<eed<eed<dZd de je d e jfd Z y) BinExprz%Baseclass for all binary expressions.)leftrightrroperatorTNrrIctt||}|jjr,|j|jjvr t t |j} ||jj||jj|S#t$r}t |d}~wwxYwr) rdrG sandboxedrintercepted_binopsr)rrrr ExceptionrOrfes rrzBinExpr.as_consts#D(3  * * !5!5!H!HH,  4== ) &TYY''14::3F3Fx3PQ Q &,A % &s#:B B7' B22B7rr+r,r-r.r2rrr]r4r[r\rFr_rrrrrrs>/ F J KMH &K!8 &AEE &rrcneZdZUdZdZeed<eed<dZd de je de jfd Z y) UnaryExprz$Baseclass for all unary expressions.rr`rTNrrIc@t||}|jjr,|j|jjvr t t |j} ||jj|S#t$r}t |d}~wwxYwr) rdrGrrintercepted_unopsr)rr`rrrs rrzUnaryExpr.as_const s#D(3  * * !5!5!G!GG,  $-- ( &TYY''12 2 &,A % &s# B B BBrr rrrr r s9. F JMH &K!8 &AEE &rr c6eZdZUdZdZeed<eed<defdZy)ra 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>NoneTruenonetrueFalsefalser@rTs rrzName.can_assign(syy RRRrN r+r,r-r.r2r]rrrrrrrrs&F I HSDSrrc6eZdZUdZdZeed<eed<defdZy)NSRefz)Reference to a namespace value assignment)r@rCr@rCrIcy)NTrrTs rrzNSRef.can_assign3s rNrrrrrr,s 3 F I IDrrceZdZdZdZy)LiteralzBaseclass for literals.TNrrrrrr;s !Hrrc eZdZUdZdZej ed<d deje dej fdZ 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). rrNrrIc|jSrrrs rrzConst.as_constKs zzrrgrGzt.Optional[Environment]cHddlm}||s t||||S)zReturn 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))clsrrgrGr"s rfrom_untrustedzConst.from_untrustedNs& ,U#, 5[AArrr)r+r,r-r.r2r[r_rr\rFr classmethodrr%rrrrrAs F 55LK!8AEE#'15 BuuB 3B/ B  BBrrcLeZdZUdZdZeed<ddeje defdZ y) TemplateDatazA constant template string.)datar)NrrIct||}|jr t|jrt |j S|j Sr)rdrNr)rMrr)rs rrzTemplateData.as_constfsA#D(3   ,    $))$ $yyrr) r+r,r-r.r2r]rr[r\rFrrrrr(r(`s+% F IK!8Crr(ceZdZUdZdZej eed<e ed<d deje dejejdffd Zdefd Zy) rzFor 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,raNrrI.cXt|tfd|jDS)Nc3@K|]}|jywrrrxrs rrz!Tuple.as_const..{s>aQZZ)>)rdr;r,rs `rrzTuple.as_constys$#D(3>4::>>>rcJ|jD]}|jryy)NFT)r,r)rOr{s rrzTuple.can_assign}s"JJD??$rr)r+r,r-r.r2r[rrrr]r\rFrr_rrrrrrrros[ F 66$< H?K!8?AGGAEESVJDW?DrrceZdZUdZdZej eed<ddeje dej ejfdZ y) rz&Any list literal such as ``[1, 2, 3]``r,r,NrrIcvt||}|jDcgc]}|j|c}Scc}wr)rdr,r)rOrr1s rrz List.as_consts/#D(3.2jj9 8$999s6r) r+r,r-r.r2r[rrrr\rFr_rrrrrrs@0 F 66$<:K!8:AFF155M:rrceZdZUdZdZej ded< d deje dejejejffdZ y) DictzeAny dict literal such as ``{1: 2, 3: 4}``. The items must be a list of :class:`Pair` nodes. r5Pairr,NrrIcXt|tfd|jDS)Nc3@K|]}|jywrr/r0s rrz Dict.as_const..s=QAJJx(=r2)rddictr,rs `rrz Dict.as_consts&$D(3=$**===rr) r+r,r-r.r2r[rrr\rFr8r_rrrrr8r8sTF 66&>37> ;/> quu >rr8ceZdZUdZdZeed<eed< d deje dejejejffdZ y) r9zA key, value pair for dicts.keyrr?rNrrIct||}|jj||jj|fSr)rdr?rrrs rrz Pair.as_consts9$D(3xx  *DJJ,?,?,IIIrr) r+r,r-r.r2rrr[r\rFrr_rrrrr9r9sO& F I K37J ;/J  Jrr9ceZdZUdZdZeed<eed<d deje dejeejffdZ y) Keywordz>A key, value pair for keyword arguments where key is a string.r>r?rNrrIcht||}|j|jj|fSr)rdr?rrrs rrzKeyword.as_consts,#D(3xx,,X666rr)r+r,r-r.r2r]rrr[r\rFrr_rrrrrBrBsDH F H K7K!87AGGCQRQVQVJDW7rrBceZdZUdZdZeed<eed<ejeed<d deje dejfd Z y) CondExprzZA conditional expression (inline if expression). (``{{ foo if bar else baz }}``) )rexpr1expr2rrFrGNrrIct||}|jj|r|jj|S|j t |jj|Sr)rdrrrFrGr)rs rrzCondExpr.as_consts^#D(3 99  h '::&&x0 0 :: , zz""8,,rr) r+r,r-r.r2rrr[r\rFr_rrrrrErEsG(F J K ::d  -K!8 -AEE -rrE)_FilterTestCommonrrc|jDcgc]}|j}}tfd|jD}|j+ |j |jj|j/ |j|jj||fS||fScc}w#t $r}t|d}~wwxYw#t $r}t|d}~wwxYw)Nc3@K|]}|jywrr/r0s rrz args_as_const..s<1!**X&*C *C C CC C8( C33C8ceZdZUdZeed<eed<ejeed<eje ed<ejeed<ejeed<dZ dZ d d eje d ejfd Zy )rI)r`r@rrLrMrNr`r@rrLrMrNTNrrIc@t||}|jr t|jr|jj }n|jj }|j|j}tj|}||tjur t|jjr.t|dddustj|r tt!||\}}|j#d|j$j'||tj(ur|j#d|n.|tjur|j#d|j ||i|S#t*$r}t|d}~wwxYw)Njinja_async_variantFTr)rdrNr) _is_filterrGfilterstestsr8r@rfrom_objcontextis_asyncr6inspectiscoroutinefunctionrOinsertr`r eval_contextr)rOrenv_mapfuncpass_argrrLrs rrz_FilterTestCommon.as_constsU#D(3   ,  ??**22G**00G{{499%$$T* <8x'7'77,     ( ( D/ 74 ?**40, $T84 f Atyy))(34 x,, , KK8 $ -- - KK8// 0 &(( ( &,A % &s<F F FFr)r+r,r-r2rrr]r[rr9r\r4rSrFr_rrrrrIrIsu IF J I &&, FF4Ljj 4  HJ"&K!8"&AEE"&rrIceZdZUdZej eed<ddej edejffd Z xZ S)rzApply 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`rrIcP|j tt| |S)N)r)r`r)superr)rOr __class__s rrzFilter.as_consts( 99 , w22rr) r+r,r-r.r[r\rrrFr_r __classcell__)rcs@rrrs> **T 3K!83AEE33rrceZdZdZdZy)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$sJrrfceZdZUdZdZeed<ejeed<eje ed<ejeed<ejeed<y) ra/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`rrLrMrNr`rrLrMrNN) r+r,r-r.r2rrr[rrBr\rrrrr1sNBF J &&, FF7Ojj 4  rrcteZdZUdZdZeed<eed<eed<d deje dejfd Z y) Getitemz@Get an attribute or item from an expression and prefer the item.)r`rqrar`rqraNrrIc"|jdk7r tt||} |jj |j j ||jj |S#t$r}t|d}~wwxYwNload) rar)rdrGgetitemr`rrqrrOrrs rrzGetitem.as_constIs 88v , #D(3 &''// ""8,dhh.?.?.I  &,A % &sA A55 B> B  Br r+r,r-r.r2rrr]r[r\rFr_rrrrririAs9J #F J I H &K!8 &AEE &rricteZdZUdZdZeed<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`rCraNrrIc|jdk7r tt||} |jj |j j ||jS#t$r}t|d}~wwxYwrk) rar)rdrGr6r`rrCrrns rrzGetattr.as_constasm 88v , #D(3 &''// 0B0B80LdiiX X &,A % &s>A&& A?/ A::A?rrorrrrqrqWs=%F J I H &K!8 &AEE &rrqceZdZUdZdZej 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`. )startstopsteprurvrwNrrIct|dtjtdtjtjffd }t ||j ||j||jS)NobjrIc,|y|jSrr/)ryrs rconstzSlice.as_const..constzs{<<) )r) rdr[r\rr_slicerurvrw)rOrr{s ` rrzSlice.as_constwsd#D(3 *qzz$' *AJJquu,= * U4::&dii(8% :JKKrr) r+r,r-r.r2r[r\rrrFr|rrrrrtrtmsZ'F ::d  **T  **T LK!8LELrrtcfeZdZUdZdZej eed<ddeje de fdZ y) ConcatzXConcatenates the list of expressions provided after converting them to strings. rrNrrIcdt|djfd|jDS)Nrjc3RK|]}t|j ywr)r]rr0s rrz"Concat.as_const..sEQs1::h/0Es$')rdrrrs `rrzConcat.as_consts(#D(3wwE$**EEErr) r+r,r-r.r2r[rrrr\rFr]rrrrr~r~s;F 66$<FK!8FCFrr~ceZdZUdZdZeed<ejded<d deje dejfd Z y) CompareziCompares an expression with some other expressions. `ops` must be a list of :class:`Operand`\s. )expropsrOperandrNrrIc*t||}|jj|x}} |jD]<}|jj|}t |j ||}|sy|}> |S#t $r}t|d}~wwxYwrK)rdrrrr'oprr))rOrrrr new_valuers rrzCompare.as_consts#D(3++H55 &hhGG,,X6 '.ui@ !  &,A % &sAA92A99 B B  Br) r+r,r-r.r2rrr[rr\rFr_rrrrrrsBF J  K!8AEErrc*eZdZUdZdZeed<eed<y)rz$Holds an operator and an expression.)rrrrN)r+r,r-r.r2r]rrrrrrrs. F G JrrceZdZdZdZy)Mulz(Multiplies the left with the right node.r Nr+r,r-r.rrrrrrs 2HrrceZdZdZdZy)Divz#Divides the left by the right node.r Nrrrrrrs -HrrceZdZdZdZy)FloorDivzbDivides the left by the right node and converts the result into an integer by truncating. r NrrrrrrsHrrceZdZdZdZy)AddzAdd the left to the right node.rNrrrrrrs )HrrceZdZdZdZy)Subz&Subtract the right from the left node.rNrrrrrrs 0HrrceZdZdZdZy)ModzLeft modulo right.rNrrrrrrs HrrceZdZdZdZy)PowzLeft to the power of right.rNrrrrrrs %HrrcTeZdZdZdZddej edejfdZ y)AndzShort circuited AND.andNrrIct||}|jj|xr|jj|Srrdrrrrs rrz And.as_consts7#D(3yy!!(+M 0C0CH0MMrr r+r,r-r.rr[r\rFr_rrrrrrs-HNK!8NAEENrrcTeZdZdZdZddej edejfdZ y)OrzShort circuited OR.orNrrIct||}|jj|xs|jj|Srrrs rrz Or.as_consts7#D(3yy!!(+Ltzz/B/B8/LLrrrrrrrrs-HMK!8MAEEMrrceZdZdZdZy)NotzNegate the expression.rNrrrrrrs  HrrceZdZdZdZy)NegzMake the expression negative.rNrrrrrrs 'HrrceZdZdZdZy)Posz8Make the expression positive (noop for most expressions)rNrrrrrrs BHrrc eZdZUdZdZeed<y)EnvironmentAttributezLoads an attribute from the environment object. This is useful for extensions that want to call a callback stored on the environment. rr@Nr+r,r-r.r2r]rrrrrrsF Irrc*eZdZUdZdZeed<eed<y)ExtensionAttributezReturns 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@rr@Nrrrrrrs$FO Irrc eZdZUdZdZeed<y) 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. ) importnamerNrrrrrrs FOrrc(eZdZUdZdZeed<ddZy) 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@Nctd)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]rrPrrrrr)sF I rrcLeZdZUdZdZeed<ddeje de fdZ y) MarkSafez:Mark the wrapped expression as safe (wrap it as `Markup`).rrNrrIcbt||}t|jj|Sr)rdrrrrs rrzMarkSafe.as_constAs(#D(3dii((233rr) r+r,r-r.r2rrr[r\rFrrrrrrr;s+D F J4K!84F4rrceZdZUdZdZeed< ddeje deje ejffdZ y) MarkSafeIfAutoescapezMark the wrapped expression as safe (wrap it as `Markup`) but only if autoescaping is active. .. versionadded:: 2.5 rrNrrIct||}|jr t|jj |}|j r t |S|Sr)rdrNr)rrrMr)rOrrs rrzMarkSafeIfAutoescape.as_constPsM$D(3   , yy!!(+   $<  rr)r+r,r-r.r2rrr[r\rFrrr_rrrrrrFsG F J37  ;/    rrceZdZdZy)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*rrrrr\srrceZdZdZy)DerivedContextReferencezReturn 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*rrrrrnsrrceZdZdZy)ContinuezContinue a loop.Nr*rrrrrwsrrceZdZdZy)Breakz Break a loop.Nr*rrrrr{srrc:eZdZUdZdZej eed<y)ScopezAn artificial scope.rrNrrrrrrs F &&,rrcDeZdZUdZdZeed<eje ed<y) OverlayScopeaAn 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 )rWrrWrN) r+r,r-r.r2rrr[rr rrrrrs! !F M &&,rrc:eZdZUdZdZej eed<y)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))]) )optionsrN) r+r,r-r.r2r[rrBrrrrrrsF VVG_rrc:eZdZUdZdZej eed<y)ScopedEvalContextModifierzModifies 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`. rrNrrrrrrs F &&,rrrrLz te.NoReturnctd)Nzcan't create custom node typesr)rrLs r _failing_newrs 4 55r)zr.rYrtypingr[ collectionsr markupsaferutilsr TYPE_CHECKINGtyping_extensionsterGrTypeVarrmultruedivfloordivpowmodaddsubrr8r]Callabler_rnot_posnegrrr r!ger#ler'rr)r=r0rFr\rdr rrrrrrrrrrrrrrrrrrrrr rrrrr(rrr9rBrErrOrIrrfrrirqrtr~rrrrrrrrrrrrrrrrrrrrrrrrrrrrr staticmethodr>rrrrs ??"( QYY|6 2         ,,   BsAJJquu~quu'<==> ==  : qvvc1::quugquun556 ++ ++ ++ KK ++ KK  $ BsAJJquu~quu'<==> CC1t1""".6 ;(?KnXnb4 T tTd$$ D   $ 4  D dT$tT$4.&d&2&&0S4S" D d BGB> 7 G*:7: >7 > J6 J 7f 7-t-, ''- .:;**[:QWWQVVAEE]AFF155!%%<0 01*-&-&`3 3"    !4 ! &d&,&d&,LDL* FT Fd8f' ' w' ' ' ' N'NMM) ) )4  4 4 $4t44,t$dtDD4& $  3666=6 -r