File "nodes.cpython-37.pyc"

Full Path: /home/attunedd/public_html/byp/izo/con7ext_sym404/rintoar.txt/opt/alt/python37/lib/python3.7/site-packages/jinja2/__pycache__/nodes.cpython-37.pyc
File size: 40.42 KB
MIME-type: text/x-bytecode.python
Charset: 8 bit

B

Ia	@s2UdZddlZddlZddlZddlmZddlmZddl	m
Z
ejr\ddlZ
ddlmZejdd	d
ZejejejejejejejdZejeejejejgejffed<ejej ej!d
Z"ejeejejgejffed<ej#ej$ej%ej&ej'ej(dddddZ)ejeejejejgejffed<Gddde*Z+Gddde,Z-GdddZ.d	ej/e.e.dddZ0Gdd	d	e-dZ1Gdd d e1Z2Gd!d"d"e1Z3Gd#d$d$e1Z4Gd%d&d&e2Z5Gd'd(d(e2Z6Gd)d*d*e2Z7Gd+d,d,e2Z8Gd-d.d.e2Z9Gd/d0d0e2Z:Gd1d2d2e2Z;Gd3d4d4e2Z<Gd5d6d6e2Z=Gd7d8d8e2Z>Gd9d:d:e2Z?Gd;d<d<e2Z@Gd=d>d>e2ZAGd?d@d@e2ZBGdAdBdBe2ZCGdCdDdDe1ZDGdEdFdFeDZEGdGdHdHeDZFGdIdJdJeDZGGdKdLdLeDZHGdMdNdNeDZIGdOdPdPeIZJGdQdRdReIZKGdSdTdTeIZLGdUdVdVeIZMGdWdXdXeIZGdYdZdZe3ZNGd[d\d\e3ZOGd]d^d^eDZPejQd_ej/e.ejLejMejejejejffd`dadbZRGdcddddeDZSGdedfdfeSZTGdgdhdheSZUGdidjdjeDZVGdkdldleDZWGdmdndneDZXGdodpdpeDZYGdqdrdreDZZGdsdtdteDZ[Gdudvdve3Z\GdwdxdxeEZ]GdydzdzeEZ^Gd{d|d|eEZ_Gd}d~d~eEZ`GdddeEZaGdddeEZbGdddeEZcGdddeEZdGdddeEZeGdddeFZfGdddeFZgGdddeFZhGdddeDZiGdddeDZjGdddeDZkGdddeDZlGdddeDZmGdddeDZnGdddeDZoGdddeDZpGddde2ZqGddde2ZrGddde2ZsGddde2ZtGddde2ZuGdddeuZvejejddddZwexewe-_y[wdS)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)*/z//z**%+-_binop_to_func)notr
r
_uaop_to_funccCs||kS)N)abrr=/opt/alt/python37/lib/python3.7/site-packages/jinja2/nodes.py<lambda>+rcCs||kS)Nr)rrrrrr,r)eqnegtZgteqltZlteqinZnotin_cmpop_to_funcc@seZdZdZdS)
Impossiblez8Raised if the node could not perform a requested action.N)__name__
__module____qualname____doc__rrrrr0src@seZdZdZddZdS)NodeTypezA metaclass for nodes that handles the field and attribute
    inheritance.  fields and attributes from the parent class are
    automatically forwarded to the child.cCsx|dD]t}g}|t|r |dnt|d|||dt|dksRtdt|tt|ksntdt|||<qW|ddt	
||||S)	N)fields
attributesrrrz multiple inheritance not allowedzlayout conflictabstractF)extendgetattrobjectgetlenAssertionErrorsettuple
setdefaulttype__new__)ZmcsnamebasesdattrZstoragerrrr19s
zNodeType.__new__N)rr r!r"r1rrrrr#4sr#c@s`eZdZdZd
dejeddddZejeej	fddd	Z
ejeej	fdd
ddZdS)EvalContextzcHolds evaluation time information.  Custom attributes can be attached
    to it in extensions.
    Nr)environment
template_namereturncCs0||_t|jr|||_n|j|_d|_dS)NF)r7callable
autoescapevolatile)selfr7r8rrr__init__Js

zEvalContext.__init__)r9cCs
|jS)N)__dict__copy)r=rrrsaveTszEvalContext.save)oldr9cCs|j|j|dS)N)r?clearupdate)r=rBrrrrevertWs
zEvalContext.revert)N)rr r!r"tOptionalstrr>MappingAnyrArErrrrr6Es
r6)nodectxr9cCs(|dkr$|jdkrtdt|jS|S)NzIif no eval context is passed, the node must have an attached environment.)r7RuntimeErrorr6)rKrLrrrget_eval_context\s

rNc@seZdZUdZdZejedfed<dZ	ejedfed<dZ
eed<ejd	ed
<ej
ej
ddd
dZd+ejejeejejeejejeej
fdddZd,ejejeejejeejddddZejeejedddZejejeejejedffejedddZeddddZd-eeddddZd	dd d!d"Zej
ed#d$d%ZejZed&d'd(Zed&d)d*Z dS).raBaseclass 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.r$)linenor7r%TrOrr7N)r$r%r9cOs|jrtd|rt|t|jkrt|js>tt|jdtt|jdt|jdt|jdkrjdndx$t|j|D]\}}t|||qWx"|jD]}t|||	|dqW|rtdt
t|dS)	Nz#abstract nodes are not instantiablez takes 0 argumentsz takes 0 or z	 argumentrszunknown attribute )r&	TypeErrorr+r$r0rzipsetattrr%popnextiter)r=r$r%r2argr5rrrr>s4z
Node.__init__)excludeonlyr9c	csnxh|jD]^}|dkr|dks<|dk	r,||ks<|dk	r||kry|t||fVWqtk
rdYqXqWdS)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)r$r(AttributeError)r=rYrZr2rrriter_fieldsszNode.iter_fieldsccsXxR|||D]B\}}t|tr@x.|D]}t|tr&|Vq&Wqt|tr|VqWdS)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)r\
isinstancelistr)r=rYrZ_itemnrrriter_child_nodess	



zNode.iter_child_nodes)	node_typer9cCsx||D]}|SWdS)ziFind the first node of a given type.  If no such node exists the
        return value is `None`.
        N)find_all)r=rcresultrrrfindsz	Node.findccs6x0|D]$}t||r|V||EdHq
WdS)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)rbr]rd)r=rcchildrrrrds
z
Node.find_all)rLr9cCs>t|g}x.|r8|}d|jkr(||_||qW|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.
        rL)rpopleftr$rLr'rb)r=rLtodorKrrrset_ctxs

zNode.set_ctxF)rOoverrider9cCsLt|g}x<|rF|}d|jkr6|jdks0|r6||_||qW|S)z.Set the line numbers of the node and children.rON)rrhr%rOr'rb)r=rOrkrirKrrr
set_linenos

zNode.set_lineno)r7r9cCs4t|g}x$|r.|}||_||qW|S)z"Set the environment for all nodes.)rrhr7r'rb)r=r7rirKrrrset_environments
zNode.set_environment)otherr9cCs,t|t|k	rtSt|t|kS)N)r0NotImplementedr.r\)r=rnrrr__eq__szNode.__eq__)r9cs0dfddjD}tjd|dS)Nz, c3s$|]}|dt|dVqdS)=N)r().0r)r=rr	<genexpr>sz Node.__repr__.<locals>.<genexpr>())joinr$r0r)r=Zargs_strr)r=r__repr__sz
Node.__repr__cs8tjttjfddfddg|dS)N)rKr9cst|tst|dSdt|jd|jsHddSxt|jD]t\}}|rjdt||}t|t	rdx*t|D]\}}|rd|qWdqT|qTWddS)Nznodes.rtruz, [])
r]rappendreprr0rr$	enumerater(r^)rKidxfieldvaluer`)_dumpbufrrrs(






zNode.dump.<locals>._dumprQ)rFUnionrrJrv)r=r)rrrdumps"z	Node.dump)NN)NN)F)!rr r!r"r$rFTuplerH__annotations__r%r&intrGrJr>	ContainerIteratorr\rbTyperrfrrdrjboolrlrmrpr)__hash__rwrrrrrrgs.
 

"		)	metaclassc@seZdZdZdZdS)StmtzBase node for all statements.TN)rr r!r"r&rrrrrsrc@seZdZdZdZdS)Helperz,Nodes that exist in a specific context only.TN)rr r!r"r&rrrrrsrc@s$eZdZUdZdZejeed<dS)TemplatezjNode that represents a template.  This must be the outermost node that
    is passed to the compiler.
    )bodyrN)	rr r!r"r$rFListrrrrrrr$s
rc@s$eZdZUdZdZejded<dS)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)rr r!r"r$rFrrrrrrr-s
rc@seZdZUdZdZded<dS)Extendsz Represents an extends statement.)templaterrN)rr r!r"r$rrrrrr6s
rc@sXeZdZUdZdZeed<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`.
    )targetrWrelse_test	recursiverrWrrrrN)rr r!r"r$rrrFrrGrrrrrr=s
rc@sHeZdZUdZdZeed<ejeed<ejded<ejeed<dS)Ifz4If `test` is true, `body` is rendered, else `else_`.)rrelif_rrrrrN)	rr r!r"r$rrrFrrrrrrOs
rc@sHeZdZUdZdZeed<ejded<ejded<eje	ed<d	S)
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.
    )r2argsdefaultsrr2NamerrrrN)
rr r!r"r$rHrrFrrrrrrrYs
rc@sHeZdZUdZdZded<ejded<ejded<ejeed	<d
S)	CallBlockzLike a macro without a name but a call instead.  `call` is called with
    the unnamed macro as `caller` argument this node holds.
    )callrrrCallrrrrrrN)	rr r!r"r$rrFrrrrrrrfs
rc@s,eZdZUdZdZejeed<ded<dS)FilterBlockzNode for filter sections.)rfilterrFilterrN)	rr r!r"r$rFrrrrrrrrrs
rc@s@eZdZUdZdZejded<ejded<ejeed<dS)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)	rr r!r"r$rFrrrrrrrrzs

rc@s<eZdZUdZdZeed<eje	ed<e
ed<e
ed<dS)BlockzkA node that represents a block.

    .. versionchanged:: 3.0.0
        the `required` field was added.
    )r2rscopedrequiredr2rrrN)rr r!r"r$rHrrFrrrrrrrrs
rc@s.eZdZUdZdZded<eed<eed<dS)Includez'A node that represents the include tag.)rwith_contextignore_missingrrrrN)rr r!r"r$rrrrrrrs

rc@s.eZdZUdZdZded<eed<eed<dS)Importz&A node that represents the import tag.)rrrrrrrN)rr r!r"r$rrHrrrrrrs

rc@sHeZdZUdZdZded<ejeje	ej
e	e	ffed<eed<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.
    )rnamesrrrrrN)rr r!r"r$rrFrrrHrrrrrrrs


"rc@seZdZUdZdZeed<dS)ExprStmtzAA statement that evaluates an expression and discards the result.)rKrKN)rr r!r"r$rrrrrrrs
rc@s&eZdZUdZdZded<eed<dS)Assignz"Assigns an expression to a target.)rrKrrrKN)rr r!r"r$rrrrrrrs
rc@s:eZdZUdZdZded<ejded<eje	ed<dS)	AssignBlockzAssigns a block to a target.)rrrrrrrrN)
rr r!r"r$rrFrGrrrrrrrs

rc@s<eZdZdZdZd
ejeejdddZ	e
ddd	ZdS)rzBaseclass for all expressions.TN)eval_ctxr9cCs
tdS)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.
        N)r)r=rrrras_constsz
Expr.as_const)r9cCsdS)z8Check if it's possible to assign something to this node.Fr)r=rrr
can_assignszExpr.can_assign)N)rr r!r"r&rFrGr6rJrrrrrrrrs
rc@sLeZdZUdZdZeed<eed<eed<dZde	j
ee	jdd	d
Z
dS)BinExprz%Baseclass for all binary expressions.)leftrightrroperatorTN)rr9c
Cszt||}|jjr&|j|jjkr&tt|j}y||j||j	|St
k
rt}zt|Wdd}~XYnXdS)N)rNr7	sandboxedrZintercepted_binopsrrrrr	Exception)r=rferrrrs

zBinExpr.as_const)N)rr r!r"r$rrrHr&rFrGr6rJrrrrrrs
rc@sDeZdZUdZdZeed<eed<dZd
e	j
ee	jddd	Z
dS)	UnaryExprz$Baseclass for all unary expressions.)rKrKrTN)rr9c
Cspt||}|jjr&|j|jjkr&tt|j}y||j|St	k
rj}zt|Wdd}~XYnXdS)N)
rNr7rrZintercepted_unopsrrrKrr)r=rrrrrrr	s

zUnaryExpr.as_const)N)rr r!r"r$rrrHr&rFrGr6rJrrrrrrs
rc@s4eZdZUdZdZeed<eed<edddZdS)	raLooks 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.
    )r2rLr2rL)r9cCs
|jdkS)N>FalseTruefalsetrueNonenone)r2)r=rrrr&szName.can_assignN)	rr r!r"r$rHrrrrrrrrs

rc@s4eZdZUdZdZeed<eed<edddZdS)	NSRefz)Reference to a namespace value assignment)r2r5r2r5)r9cCsdS)NTr)r=rrrr1szNSRef.can_assignN)	rr r!r"r$rHrrrrrrrr*s

rc@seZdZdZdZdS)LiteralzBaseclass for literals.TN)rr r!r"r&rrrrr9src@s\eZdZUdZdZejed<deje	ejdddZ
ed
ejejeddd	d
dZ
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).
    )rrN)rr9cCs|jS)N)r)r=rrrrrIszConst.as_constzt.Optional[Environment])rrOr7r9cCs(ddlm}||st||||dS)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_repr)rOr7)compilerrr)clsrrOr7rrrrfrom_untrustedLszConst.from_untrusted)N)NN)rr r!r"r$rFrJrrGr6rclassmethodrrrrrrr?s

rc@s6eZdZUdZdZeed<deje	edddZ
dS)	TemplateDatazA constant template string.)datarN)rr9cCs,t||}|jrt|jr&t|jS|jS)N)rNr<rr;rr)r=rrrrrds

zTemplateData.as_const)N)rr r!r"r$rHrrFrGr6rrrrrr^s
rc@s^eZdZUdZdZejeed<e	ed<d
ej
eejej
dfddd	Zed
ddZdS)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.
    )itemsrLrrLN.)rr9cs"t|tfdd|jDS)Nc3s|]}|VqdS)N)r)rrx)rrrrsysz!Tuple.as_const.<locals>.<genexpr>)rNr.r)r=rr)rrrws
zTuple.as_const)r9cCs x|jD]}|sdSqWdS)NFT)rr)r=r`rrrr{szTuple.can_assign)N)rr r!r"r$rFrrrrHrGr6rrJrrrrrrrrms
$rc@sDeZdZUdZdZejeed<dej	e
ejejdddZdS)	rz&Any list literal such as ``[1, 2, 3]``)rrN)rr9cst|fdd|jDS)Ncsg|]}|qSr)r)rrr)rrr
<listcomp>sz!List.as_const.<locals>.<listcomp>)rNr)r=rr)rrrs
z
List.as_const)N)
rr r!r"r$rFrrrrGr6rJrrrrrrs
rc@sJeZdZUdZdZejded<d	eje	ej
ejejfdddZdS)
DictzeAny dict literal such as ``{1: 2, 3: 4}``.  The items must be a list of
    :class:`Pair` nodes.
    )rPairrN)rr9cs"t|tfdd|jDS)Nc3s|]}|VqdS)N)r)rrr)rrrrssz Dict.as_const.<locals>.<genexpr>)rNdictr)r=rr)rrrs
z
Dict.as_const)N)
rr r!r"r$rFrrrGr6rrJrrrrrrs


rc@sLeZdZUdZdZeed<eed<d	eje	ej
ejejfdddZdS)
rzA key, value pair for dicts.)keyrrrN)rr9cCs"t||}|j||j|fS)N)rNrrr)r=rrrrrs
z
Pair.as_const)N)
rr r!r"r$rrrFrGr6rrJrrrrrrs

rc@sJeZdZUdZdZeed<eed<d	ej	e
ejeejfdddZ
dS)
Keywordz>A key, value pair for keyword arguments where key is a string.)rrrrN)rr9cCst||}|j|j|fS)N)rNrrr)r=rrrrrs
zKeyword.as_const)N)rr r!r"r$rHrrrFrGr6rrJrrrrrrs

rc@sNeZdZUdZdZeed<eed<ejeed<d
eje	ej
ddd	ZdS)CondExprzZA conditional expression (inline if expression).  (``{{
    foo if bar else baz }}``)
    )rexpr1expr2rrrN)rr9cCs>t||}|j|r"|j|S|jdkr2t|j|S)N)rNrrrrr)r=rrrrrs

zCondExpr.as_const)N)rr r!r"r$rrrFrGr6rJrrrrrrs
r)_FilterTestCommonr)rKrr9c
sfdd|jD}tfdd|jD}|jdk	rxy||jWn*tk
rv}zt|Wdd}~XYnX|jdk	ry|	|jWn*tk
r}zt|Wdd}~XYnX||fS)Ncsg|]}|qSr)r)rrr)rrrrsz!args_as_const.<locals>.<listcomp>c3s|]}|VqdS)N)r)rrr)rrrrssz args_as_const.<locals>.<genexpr>)
rrkwargsdyn_argsr'rrr
dyn_kwargsrD)rKrrrrr)rr
args_as_consts

rc@s|eZdZUdZeed<eed<ejeed<eje	ed<ej
eed<ej
eed<dZdZd
ej
e
ejd
ddZd	S)r)rKr2rrrrrKr2rrrrTN)rr9c
Cst||}|jrt|jr&|jj}n|jj}||j}t	
|}|dksV|t	jkr\t|jjrt
|dddks~t|rtt||\}}|d|j||t	jkr|d|n|t	jkr|d|jy
|||Stk
r}zt|Wdd}~XYnXdS)NZjinja_async_variantFTr)rNr<r
_is_filterr7filterstestsr*r2rZfrom_objcontextZis_asyncr(inspectiscoroutinefunctionrinsertrKrZeval_contextr)r=rZenv_mapfuncZpass_argrrrrrrrs0






z_FilterTestCommon.as_const)N)rr r!r$rrrHrFrrrGr&rr6rJrrrrrrs
rcsBeZdZUdZejeed<dejeej	dfdd
Z
ZS)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.
    rKN)rr9cs|jdkrttj|dS)N)r)rKrsuperr)r=r)	__class__rrrs
zFilter.as_const)N)rr r!r"rFrGrrr6rJr
__classcell__rr)rrrs
rc@seZdZdZdZdS)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)rr r!r"rrrrrr"src@sVeZdZUdZdZeed<ejeed<eje	ed<ej
eed<ej
eed<dS)	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.
    )rKrrrrrKrrrrN)rr r!r"r$rrrFrrrGrrrrr/s
rc@sHeZdZUdZdZeed<eed<eed<d
ej	e
ejddd	ZdS)Getitemz@Get an attribute or item from an expression and prefer the item.)rKrXrLrKrXrLN)rr9c
Csh|jdkrtt||}y|j|j||j|Stk
rb}zt|Wdd}~XYnXdS)Nload)	rLrrNr7getitemrKrrXr)r=rrrrrrGs

zGetitem.as_const)N)
rr r!r"r$rrrHrFrGr6rJrrrrrr?s
rc@sHeZdZUdZdZeed<eed<eed<d
ej	e
ejddd	ZdS)GetattrznGet an attribute or item from an expression that is a ascii-only
    bytestring and prefer the attribute.
    )rKr5rLrKr5rLN)rr9c
Csb|jdkrtt||}y|j|j||jStk
r\}zt|Wdd}~XYnXdS)Nr)	rLrrNr7r(rKrr5r)r=rrrrrr_s

zGetattr.as_const)N)
rr r!r"r$rrrHrFrGr6rJrrrrrrUs
rc@sXeZdZUdZdZejeed<ejeed<ejeed<d
eje	e
ddd	ZdS)Slicez_Represents a slice object.  This must only be used as argument for
    :class:`Subscript`.
    )startstopsteprrrN)rr9csJt|tjttjtjdfdd}t||j||j||jS)N)objr9cs|dkrdS|S)N)r)r)rrrconstxszSlice.as_const.<locals>.const)	rNrFrGrrJslicerrr)r=rrr)rrrus
"zSlice.as_const)N)rr r!r"r$rFrGrrr6rrrrrrrks
rc@s<eZdZUdZdZejeed<dej	e
edddZdS)	ConcatzXConcatenates the list of expressions provided after converting
    them to strings.
    )rrN)rr9cs$t|dfdd|jDS)NrQc3s|]}t|VqdS)N)rHr)rrr)rrrrssz"Concat.as_const.<locals>.<genexpr>)rNrvr)r=rr)rrrs
zConcat.as_const)N)
rr r!r"r$rFrrrrGr6rHrrrrrrs
rc@sFeZdZUdZdZeed<ejded<d
ej	e
ejddd	ZdS)CompareziCompares an expression with some other expressions.  `ops` must be a
    list of :class:`Operand`\s.
    )expropsrOperandrN)rr9c
Cst||}|j|}}y<x6|jD],}|j|}t|j||}|sLdS|}q$WWn*tk
r}zt|Wdd}~XYnX|S)NF)rNrrrroprr)r=rrerrZ	new_valuerrrrrs
zCompare.as_const)N)
rr r!r"r$rrrFrrGr6rJrrrrrrs

rc@s&eZdZUdZdZeed<eed<dS)rz$Holds an operator and an expression.)rrrrN)rr r!r"r$rHrrrrrrrs
rc@seZdZdZdZdS)Mulz(Multiplies the left with the right node.r
N)rr r!r"rrrrrrsrc@seZdZdZdZdS)Divz#Divides the left by the right node.rN)rr r!r"rrrrrrsrc@seZdZdZdZdS)FloorDivzbDivides the left by the right node and converts the
    result into an integer by truncating.
    z//N)rr r!r"rrrrrrsrc@seZdZdZdZdS)AddzAdd the left to the right node.r
N)rr r!r"rrrrrrsrc@seZdZdZdZdS)Subz&Subtract the right from the left node.rN)rr r!r"rrrrrrsrc@seZdZdZdZdS)ModzLeft modulo right.rN)rr r!r"rrrrrrsrc@seZdZdZdZdS)PowzLeft to the power of right.z**N)rr r!r"rrrrrrsrc@s.eZdZdZdZdejeejdddZ	dS)AndzShort circuited AND.andN)rr9cCs"t||}|j|o |j|S)N)rNrrr)r=rrrrrs
zAnd.as_const)N)
rr r!r"rrFrGr6rJrrrrrrsrc@s.eZdZdZdZdejeejdddZ	dS)OrzShort circuited OR.orN)rr9cCs"t||}|j|p |j|S)N)rNrrr)r=rrrrrs
zOr.as_const)N)
rr r!r"rrFrGr6rJrrrrrr	sr	c@seZdZdZdZdS)NotzNegate the expression.rN)rr r!r"rrrrrrsrc@seZdZdZdZdS)NegzMake the expression negative.rN)rr r!r"rrrrrrsrc@seZdZdZdZdS)Posz8Make the expression positive (noop for most expressions)r
N)rr r!r"rrrrrr
sr
c@seZdZUdZdZeed<dS)EnvironmentAttributezLoads an attribute from the environment object.  This is useful for
    extensions that want to call a callback stored on the environment.
    )r2r2N)rr r!r"r$rHrrrrrrs
rc@s&eZdZUdZdZeed<eed<dS)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.
    )
identifierr2rr2N)rr r!r"r$rHrrrrrrs
rc@seZdZUdZdZeed<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.
    )
importnamerN)rr r!r"r$rHrrrrrrs
rc@s,eZdZUdZdZeed<ddddZdS)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.
    )r2r2N)r9cCstddS)NzKCan't create internal names.  Use the `free_identifier` method on a parser.)rR)r=rrrr>2szInternalName.__init__)rr r!r"r$rHrr>rrrrr's
rc@s6eZdZUdZdZeed<deje	e
dddZdS)	MarkSafez:Mark the wrapped expression as safe (wrap it as `Markup`).)rrN)rr9cCst||}t|j|S)N)rNrrr)r=rrrrr?s
zMarkSafe.as_const)N)rr r!r"r$rrrFrGr6rrrrrrr9s
rc@sBeZdZUdZdZeed<deje	ej
eejfdddZ
dS)	MarkSafeIfAutoescapezMark the wrapped expression as safe (wrap it as `Markup`) but
    only if autoescaping is active.

    .. versionadded:: 2.5
    )rrN)rr9cCs4t||}|jrt|j|}|jr0t|S|S)N)rNr<rrrr;r)r=rrrrrrNs
zMarkSafeIfAutoescape.as_const)N)rr r!r"r$rrrFrGr6rrrJrrrrrrDs


rc@seZdZdZdS)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.
    N)rr r!r"rrrrrZsrc@seZdZdZdS)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
    N)rr r!r"rrrrrlsrc@seZdZdZdS)ContinuezContinue a loop.N)rr r!r"rrrrrusrc@seZdZdZdS)Breakz
Break a loop.N)rr r!r"rrrrrysrc@s$eZdZUdZdZejeed<dS)ScopezAn artificial scope.)rrN)	rr r!r"r$rFrrrrrrrr}s
rc@s,eZdZUdZdZeed<eje	ed<dS)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
    )rrrrN)
rr r!r"r$rrrFrrrrrrrs
rc@s$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))])
    )optionsrN)	rr r!r"r$rFrrrrrrrrs
rc@s$eZdZUdZdZejeed<dS)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`.
    )rrN)	rr r!r"r$rFrrrrrrrrs
rzte.NoReturn)rrr9cOstddS)Nzcan't create custom node types)rR)rrrrr_failing_newsr)zr"rrtypingrFcollectionsrZ
markupsaferutilsr
TYPE_CHECKINGZtyping_extensionster7rTypeVarrmultruedivfloordivpowmodaddsubrrrHCallablerJrnot_posnegrrrrgerlerrrr0r#r6rGrNrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr	rrr
rrrrrrrrrrrrrrrstaticmethodr1rrrr<module>s0,22		


			.0