Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib/python3.7/site-packages/jinja2/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/jinja2/__pycache__/nodes.cpython-37.pyc

B

I��a���	@s2UdZddlZddlZddlZddlmZddlmZddl	m
Z
ejr\ddlZ
ddlmZejdd	d
�Zejejejejejejejd�Zejeejejejgejffed<ejej ej!d
�Z"ejeejejgejffed<ej#ej$ej%ej&ej'ej(dd�dd�d�Z)ejeejejejgejffed<Gdd�de*�Z+Gdd�de,�Z-Gdd�d�Z.d	ej/e.e.d�dd�Z0Gdd	�d	e-d�Z1Gdd �d e1�Z2Gd!d"�d"e1�Z3Gd#d$�d$e1�Z4Gd%d&�d&e2�Z5Gd'd(�d(e2�Z6Gd)d*�d*e2�Z7Gd+d,�d,e2�Z8Gd-d.�d.e2�Z9Gd/d0�d0e2�Z:Gd1d2�d2e2�Z;Gd3d4�d4e2�Z<Gd5d6�d6e2�Z=Gd7d8�d8e2�Z>Gd9d:�d:e2�Z?Gd;d<�d<e2�Z@Gd=d>�d>e2�ZAGd?d@�d@e2�ZBGdAdB�dBe2�ZCGdCdD�dDe1�ZDGdEdF�dFeD�ZEGdGdH�dHeD�ZFGdIdJ�dJeD�ZGGdKdL�dLeD�ZHGdMdN�dNeD�ZIGdOdP�dPeI�ZJGdQdR�dReI�ZKGdSdT�dTeI�ZLGdUdV�dVeI�ZMGdWdX�dXeI�ZGdYdZ�dZe3�ZNGd[d\�d\e3�ZOGd]d^�d^eD�ZPejQd_ej/e.ejLejMejejejejffd`�dadb�ZRGdcdd�ddeD�ZSGdedf�dfeS�ZTGdgdh�dheS�ZUGdidj�djeD�ZVGdkdl�dleD�ZWGdmdn�dneD�ZXGdodp�dpeD�ZYGdqdr�dreD�ZZGdsdt�dteD�Z[Gdudv�dve3�Z\Gdwdx�dxeE�Z]Gdydz�dzeE�Z^Gd{d|�d|eE�Z_Gd}d~�d~eE�Z`Gdd��d�eE�ZaGd�d��d�eE�ZbGd�d��d�eE�ZcGd�d��d�eE�ZdGd�d��d�eE�ZeGd�d��d�eF�ZfGd�d��d�eF�ZgGd�d��d�eF�ZhGd�d��d�eD�ZiGd�d��d�eD�ZjGd�d��d�eD�ZkGd�d��d�eD�ZlGd�d��d�eD�ZmGd�d��d�eD�ZnGd�d��d�eD�ZoGd�d��d�eD�ZpGd�d��d�e2�ZqGd�d��d�e2�ZrGd�d��d�e2�ZsGd�d��d�e2�ZtGd�d��d�e2�ZuGd�d��d�eu�Zvejejd�d��d�d��Zwexew�e-_y[wdS)�z�AST nodes generated by the parser for the compiler. Also provides
some node tree helper functions used by the parser and compiler in order
to normalize nodes.
�N)�deque)�Markup�)�_PassArg)�Environment�
_NodeBound�Node)�bound)�*�/z//z**�%�+�-�_binop_to_func)�notr
r�
_uaop_to_funccCs||kS)N�)�a�brr�=/opt/alt/python37/lib/python3.7/site-packages/jinja2/nodes.py�<lambda>+�rcCs||kS)Nr)rrrrrr,r)�eq�ne�gtZgteq�ltZlteq�inZnotin�_cmpop_to_funcc@seZdZdZdS)�
Impossiblez8Raised if the node could not perform a requested action.N)�__name__�
__module__�__qualname__�__doc__rrrrr0src@seZdZdZdd�ZdS)�NodeTypez�A metaclass for nodes that handles the field and attribute
    inheritance.  fields and attributes from the parent class are
    automatically forwarded to the child.cCs�x|dD]t}g}|�t|r |dnt|d��|�|�|d��t|�dksRtd��t|�tt|��ksntd��t|�||<qW|�dd�t	�
||||�S)	N)�fields�
attributesrrrz multiple inheritance not allowedzlayout conflict�abstractF)�extend�getattr�object�get�len�AssertionError�set�tuple�
setdefault�type�__new__)Zmcs�name�bases�d�attrZstoragerrrr19s
zNodeType.__new__N)rr r!r"r1rrrrr#4sr#c@s`eZdZdZd
dejedd�dd�Zejeej	fd�dd	�Z
ejeej	fdd
�dd�ZdS)�EvalContextzcHolds evaluation time information.  Custom attributes can be attached
    to it in extensions.
    Nr)�environment�
template_name�returncCs0||_t|j�r|�|�|_n|j|_d|_dS)NF)r7�callable�
autoescape�volatile)�selfr7r8rrr�__init__Js

zEvalContext.__init__)r9cCs
|j��S)N)�__dict__�copy)r=rrr�saveTszEvalContext.save)�oldr9cCs|j��|j�|�dS)N)r?�clear�update)r=rBrrr�revertWs
zEvalContext.revert)N)rr r!r"�t�Optional�strr>�Mapping�AnyrArErrrrr6Es
r6)�node�ctxr9cCs(|dkr$|jdkrtd��t|j�S|S)NzIif no eval context is passed, the node must have an attached environment.)r7�RuntimeErrorr6)rKrLrrr�get_eval_context\s

rNc@s�eZdZUdZdZejedfed<dZ	ejedfed<dZ
eed<ejd	ed
<ej
ej
dd�d
d�Zd+ejejeejejeejejeej
fd�dd�Zd,ejejeejejeejdd�dd�Zejeejed�dd�Zejejeejejedffejed�dd�Zedd�dd�Zd-eedd�dd�Zd	dd �d!d"�Zej
ed#�d$d%�ZejZed&�d'd(�Zed&�d)d*�Z dS).ra�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.r$)�linenor7r%TrOrr7N)r$r%r9cOs�|jrtd��|r�t|�t|j�krt|js>tt|�j�d���tt|�j�dt|j��dt|j�dkrjdnd����x$t|j|�D]\}}t|||�q�Wx"|jD]}t|||�	|d��q�W|r�tdt
t|������dS)	Nz#abstract nodes are not instantiablez takes 0 argumentsz takes 0 or z	 argumentr�s�zunknown attribute )r&�	TypeErrorr+r$r0r�zip�setattrr%�pop�next�iter)r=r$r%r2�argr5rrrr>s4z
Node.__init__)�exclude�onlyr9c	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=rYrZr2rrr�iter_fields�szNode.iter_fieldsccsXxR|�||�D]B\}}t|t�r@x.|D]}t|t�r&|Vq&Wqt|t�r|VqWdS)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)r\�
isinstance�listr)r=rYrZ�_�item�nrrr�iter_child_nodes�s	



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=rc�resultrrr�find�sz	Node.findccs6x0|��D]$}t||�r|V|�|�EdHq
WdS)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)rbr]rd)r=rc�childrrrrd�s
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)r�popleftr$rLr'rb)r=rL�todorKrrr�set_ctx�s

zNode.set_ctxF)rO�overrider9cCsLt|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_lineno�s

zNode.set_lineno)r7r9cCs4t|g�}x$|r.|��}||_|�|���qW|S)z"Set the environment for all nodes.)rrhr7r'rb)r=r7rirKrrr�set_environment�s
zNode.set_environment)�otherr9cCs,t|�t|�k	rtSt|���t|���kS)N)r0�NotImplementedr.r\)r=rnrrr�__eq__�szNode.__eq__)r9cs0d��fdd��jD��}t��j�d|�d�S)Nz, c3s$|]}|�dt�|d���VqdS)�=N)r()�.0r)r=rr�	<genexpr>�sz Node.__repr__.<locals>.<genexpr>�(�))�joinr$r0r)r=Zargs_strr)r=r�__repr__�sz
Node.__repr__cs8tjttjfdd���fdd��g��|�d���S)N)rKr9cs�t|t�s��t|��dS��dt|�j�d��|jsH��d�dSx�t|j�D]t\}}|rj��d�t||�}t|t	�r���d�x*t|�D]\}}|r���d��|�q�W��d�qT�|�qTW��d�dS)Nznodes.rtruz, �[�])
r]r�append�reprr0rr$�	enumerater(r^)rK�idx�field�valuer`)�_dump�bufrrr��s(






zNode.dump.<locals>._dumprQ)rF�UnionrrJrv)r=r)r�r�r�dump�s"z	Node.dump)NN)NN)F)!rr r!r"r$rF�TuplerH�__annotations__r%r&�intrGrJr>�	Container�Iteratorr\rb�Typerrfr�rdrj�boolrlrmrpr)�__hash__rwr�rrrrrgs.
 

"		)�	metaclassc@seZdZdZdZdS)�StmtzBase node for all statements.TN)rr r!r"r&rrrrr�sr�c@seZdZdZdZdS)�Helperz,Nodes that exist in a specific context only.TN)rr r!r"r&rrrrr�sr�c@s$eZdZUdZdZejeed<dS)�TemplatezjNode that represents a template.  This must be the outermost node that
    is passed to the compiler.
    )�bodyr�N)	rr r!r"r$rF�Listrr�rrrrr�$s
r�c@s$eZdZUdZdZejded<dS)�Outputz�A node that holds multiple expressions which are then printed out.
    This is used both for the `print` statement and the regular template data.
    )�nodes�Exprr�N)rr r!r"r$rFr�r�rrrrr�-s
r�c@seZdZUdZdZded<dS)�Extendsz Represents an extends statement.)�templater�r�N)rr r!r"r$r�rrrrr�6s
r�c@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`.
    )�targetrWr��else_�test�	recursiver�rWr�r�r�r�N)rr r!r"r$rr�rFr�rGr�rrrrr�=s
r�c@sHeZdZUdZdZeed<ejeed<ejded<ejeed<dS)�Ifz4If `test` is true, `body` is rendered, else `else_`.)r�r��elif_r�r�r�r�r�N)	rr r!r"r$rr�rFr�rrrrr�Os
r�c@sHeZdZUdZdZeed<ejded<ejded<eje	ed<d	S)
�Macroz�A macro definition.  `name` is the name of the macro, `args` a list of
    arguments and `defaults` a list of defaults if there are any.  `body` is
    a list of nodes for the macro body.
    )r2�args�defaultsr�r2�Namer�r�r�r�N)
rr r!r"r$rHr�rFr�rrrrrr�Ys
r�c@sHeZdZUdZdZded<ejded<ejded<ejeed	<d
S)�	CallBlockz�Like a macro without a name but a call instead.  `call` is called with
    the unnamed macro as `caller` argument this node holds.
    )�callr�r�r��Callr�r�r�r�r�r�N)	rr r!r"r$r�rFr�rrrrrr�fs
r�c@s,eZdZUdZdZejeed<ded<dS)�FilterBlockzNode for filter sections.)r��filterr��Filterr�N)	rr r!r"r$rFr�rr�rrrrr�rs
r�c@s@eZdZUdZdZejded<ejded<ejeed<dS)�Withz�Specific node for with statements.  In older versions of Jinja the
    with statement was implemented on the base of the `Scope` node instead.

    .. versionadded:: 2.9.3
    )�targets�valuesr�r�r�r�r�N)	rr r!r"r$rFr�r�rrrrrr�zs

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

    .. versionchanged:: 3.0.0
        the `required` field was added.
    )r2r��scoped�requiredr2r�r�r�N)rr r!r"r$rHr�rFr�rr�rrrrr��s
r�c@s.eZdZUdZdZded<eed<eed<dS)�Includez'A node that represents the include tag.)r��with_context�ignore_missingr�r�r�r�N)rr r!r"r$r�r�rrrrr��s

r�c@s.eZdZUdZdZded<eed<eed<dS)�Importz&A node that represents the import tag.)r�r�r�r�r�r�r�N)rr r!r"r$r�rHr�rrrrr��s

r�c@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.
    )r��namesr�r�r�r�r�N)rr r!r"r$r�rFr�r�rHr�r�rrrrr��s


"r�c@seZdZUdZdZeed<dS)�ExprStmtzAA statement that evaluates an expression and discards the result.)rKrKN)rr r!r"r$rr�rrrrr��s
r�c@s&eZdZUdZdZded<eed<dS)�Assignz"Assigns an expression to a target.)r�rKr�r�rKN)rr r!r"r$r�rrrrrr��s
r�c@s:eZdZUdZdZded<ejded<eje	ed<dS)	�AssignBlockzAssigns a block to a target.)r�r�r�r�r�r�r�r�N)
rr r!r"r$r�rFrGr�rrrrrr��s

r�c@s<eZdZdZdZd
ejeejd�dd�Z	e
d�dd	�ZdS)r�zBaseclass for all expressions.TN)�eval_ctxr9cCs
t��dS)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=r�rrr�as_const�sz
Expr.as_const)r9cCsdS)z8Check if it's possible to assign something to this node.Fr)r=rrr�
can_assign�szExpr.can_assign)N)rr r!r"r&rFrGr6rJr�r�r�rrrrr��s
r�c@sLeZdZUdZdZeed<eed<eed<dZde	j
ee	jd�d	d
�Z
dS)�BinExprz%Baseclass for all binary expressions.)�left�rightr�r��operatorTN)r�r9c
Cszt||�}|jjr&|j|jjkr&t��t|j}y||j�|�|j	�|��St
k
rt}zt�|�Wdd}~XYnXdS)N)rNr7�	sandboxedr�Zintercepted_binopsrrr�r�r��	Exception)r=r��f�errrr��s

zBinExpr.as_const)N)rr r!r"r$r�r�rHr&rFrGr6rJr�rrrrr��s
r�c@sDeZdZUdZdZeed<eed<dZd
e	j
ee	jd�dd	�Z
dS)�	UnaryExprz$Baseclass for all unary expressions.)rKrKr�TN)r�r9c
Cspt||�}|jjr&|j|jjkr&t��t|j}y||j�|��St	k
rj}zt�|�Wdd}~XYnXdS)N)
rNr7r�r�Zintercepted_unopsrrrKr�r�)r=r�r�r�rrrr�	s

zUnaryExpr.as_const)N)rr r!r"r$r�r�rHr&rFrGr6rJr�rrrrr�s
r�c@s4eZdZUdZdZeed<eed<ed�dd�ZdS)	r�aLooks 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>�False�True�false�true�None�none)r2)r=rrrr�&szName.can_assignN)	rr r!r"r$rHr�r�r�rrrrr�s

r�c@s4eZdZUdZdZeed<eed<ed�dd�ZdS)	�NSRefz)Reference to a namespace value assignment)r2r5r2r5)r9cCsdS)NTr)r=rrrr�1szNSRef.can_assignN)	rr r!r"r$rHr�r�r�rrrrr�*s

r�c@seZdZdZdZdS)�LiteralzBaseclass for literals.TN)rr r!r"r&rrrrr�9sr�c@s\eZdZUdZdZejed<deje	ejd�dd�Z
ed
ejejeddd	�d
d��Z
dS)�ConstaAll constant values.  The parser will return this node for simple
    constants such as ``42`` or ``"foo"`` but it can be used to store more
    complex values such as lists too.  Only constants with a safe
    representation (objects where ``eval(repr(x)) == x`` is true).
    )rrN)r�r9cCs|jS)N)r)r=r�rrrr�IszConst.as_constzt.Optional[Environment])rrOr7r9cCs(ddlm}||�st��||||d�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_repr)rOr7)�compilerr�r)�clsrrOr7r�rrr�from_untrustedLszConst.from_untrusted)N)NN)rr r!r"r$rFrJr�rGr6r��classmethodr�r�rrrrr�?s

r�c@s6eZdZUdZdZeed<deje	ed�dd�Z
dS)	�TemplateDatazA constant template string.)�datar�N)r�r9cCs,t||�}|jrt��|jr&t|j�S|jS)N)rNr<rr;rr�)r=r�rrrr�ds

zTemplateData.as_const)N)rr r!r"r$rHr�rFrGr6r�rrrrr�^s
r�c@s^eZdZUdZdZejeed<e	ed<d
ej
eejej
dfd�dd	�Zed
�dd�ZdS)r�z�For loop unpacking and some other things like multiple arguments
    for subscripts.  Like for :class:`Name` `ctx` specifies if the tuple
    is used for loading the names or storing.
    )�itemsrLr�rLN.)r�r9cs"t|���t�fdd�|jD��S)Nc3s|]}|���VqdS)N)r�)rr�x)r�rrrsysz!Tuple.as_const.<locals>.<genexpr>)rNr.r�)r=r�r)r�rr�ws
zTuple.as_const)r9cCs x|jD]}|��sdSqWdS)NFT)r�r�)r=r`rrrr�{szTuple.can_assign)N)rr r!r"r$rFr�r�r�rHrGr6r�rJr�r�r�rrrrr�ms
$r�c@sDeZdZUdZdZejeed<dej	e
ejejd�dd�ZdS)	r�z&Any list literal such as ``[1, 2, 3]``)r�r�N)r�r9cst|����fdd�|jD�S)Ncsg|]}|����qSr)r�)rrr�)r�rr�
<listcomp>�sz!List.as_const.<locals>.<listcomp>)rNr�)r=r�r)r�rr��s
z
List.as_const)N)
rr r!r"r$rFr�r�r�rGr6rJr�rrrrr��s
r�c@sJeZdZUdZdZejded<d	eje	ej
ejejfd�dd�ZdS)
�DictzeAny dict literal such as ``{1: 2, 3: 4}``.  The items must be a list of
    :class:`Pair` nodes.
    )r��Pairr�N)r�r9cs"t|���t�fdd�|jD��S)Nc3s|]}|���VqdS)N)r�)rrr�)r�rrrs�sz Dict.as_const.<locals>.<genexpr>)rN�dictr�)r=r�r)r�rr��s
z
Dict.as_const)N)
rr r!r"r$rFr�r�rGr6r�rJr�rrrrr��s


r�c@sLeZdZUdZdZeed<eed<d	eje	ej
ejejfd�dd�ZdS)
r�zA key, value pair for dicts.)�keyrr�rN)r�r9cCs"t||�}|j�|�|j�|�fS)N)rNr�r�r)r=r�rrrr��s
z
Pair.as_const)N)
rr r!r"r$r�r�rFrGr6r�rJr�rrrrr��s

r�c@sJeZdZUdZdZeed<eed<d	ej	e
ejeejfd�dd�Z
dS)
�Keywordz>A key, value pair for keyword arguments where key is a string.)r�rr�rN)r�r9cCst||�}|j|j�|�fS)N)rNr�rr�)r=r�rrrr��s
zKeyword.as_const)N)rr r!r"r$rHr�r�rFrGr6r�rJr�rrrrr��s

r�c@sNeZdZUdZdZeed<eed<ejeed<d
eje	ej
d�dd	�ZdS)�CondExprzZA conditional expression (inline if expression).  (``{{
    foo if bar else baz }}``)
    )r��expr1�expr2r�r�r�N)r�r9cCs>t||�}|j�|�r"|j�|�S|jdkr2t��|j�|�S)N)rNr�r�r�r�r)r=r�rrrr��s

zCondExpr.as_const)N)rr r!r"r$r�r�rFrGr6rJr�rrrrr��s
r�)�_FilterTestCommonr�)rKr�r9c
s��fdd�|jD�}t�fdd�|jD��}|jdk	rxy|�|j����Wn*tk
rv}zt�|�Wdd}~XYnX|jdk	r�y|�	|j����Wn*tk
r�}zt�|�Wdd}~XYnX||fS)Ncsg|]}|����qSr)r�)rrr�)r�rrr��sz!args_as_const.<locals>.<listcomp>c3s|]}|���VqdS)N)r�)rrr�)r�rrrs�sz args_as_const.<locals>.<genexpr>)
r�r��kwargs�dyn_argsr'r�r�r�
dyn_kwargsrD)rKr�r�r�r�r)r�r�
args_as_const�s

r�c@s|eZdZUdZeed<eed<ejeed<eje	ed<ej
eed<ej
eed<dZdZd
ej
e
ejd
�dd�Zd	S)r�)rKr2r�r�r�r�rKr2r�r�r�r�TN)r�r9c
Cst||�}|jrt��|jr&|jj}n|jj}|�|j�}t	�
|�}|dksV|t	jkr\t��|jjr�t
|dd�dks~t�|�r�t��t||�\}}|�d|j�|��|t	jkr�|�d|�n|t	jkr�|�d|j�y
|||�Stk
�r}zt�|�Wdd}~XYnXdS)NZjinja_async_variantFTr)rNr<r�
_is_filterr7�filters�testsr*r2rZfrom_obj�contextZis_asyncr(�inspect�iscoroutinefunctionr��insertrKr�Zeval_contextr�)r=r�Zenv_map�funcZpass_argr�r�r�rrrr��s0






z_FilterTestCommon.as_const)N)rr r!r$r�r�rHrFr�r�rGr&r�r6rJr�rrrrr��s
r�csBeZdZUdZejeed<dejeej	d��fdd�
Z
�ZS)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.
    rKN)r�r9cs|jdkrt��t�j|d�S)N)r�)rKr�superr�)r=r�)�	__class__rrr�s
zFilter.as_const)N)rr r!r"rFrGr�r�r6rJr��
__classcell__rr)r�rr�s
r�c@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"r�rrrrr�"sr�c@sVeZdZUdZdZeed<ejeed<eje	ed<ej
eed<ej
eed<dS)	r�a/Calls an expression.  `args` is a list of arguments, `kwargs` a list
    of keyword arguments (list of :class:`Keyword` nodes), and `dyn_args`
    and `dyn_kwargs` has to be either `None` or a node that is used as
    node for dynamic positional (``*args``) or keyword (``**kwargs``)
    arguments.
    )rKr�r�r�r�rKr�r�r�r�N)rr r!r"r$r�r�rFr�r�rGrrrrr�/s
r�c@sHeZdZUdZdZeed<eed<eed<d
ej	e
ejd�dd	�ZdS)�Getitemz@Get an attribute or item from an expression and prefer the item.)rKrXrLrKrXrLN)r�r9c
Csh|jdkrt��t||�}y|j�|j�|�|j�|��Stk
rb}zt�|�Wdd}~XYnXdS)N�load)	rLrrNr7�getitemrKr�rXr�)r=r�r�rrrr�Gs

zGetitem.as_const)N)
rr r!r"r$r�r�rHrFrGr6rJr�rrrrr�?s
r�c@sHeZdZUdZdZeed<eed<eed<d
ej	e
ejd�dd	�ZdS)�GetattrznGet an attribute or item from an expression that is a ascii-only
    bytestring and prefer the attribute.
    )rKr5rLrKr5rLN)r�r9c
Csb|jdkrt��t||�}y|j�|j�|�|j�Stk
r\}zt�|�Wdd}~XYnXdS)Nr�)	rLrrNr7r(rKr�r5r�)r=r�r�rrrr�_s

zGetattr.as_const)N)
rr r!r"r$r�r�rHrFrGr6rJr�rrrrr�Us
r�c@sXeZdZUdZdZejeed<ejeed<ejeed<d
eje	e
d�dd	�ZdS)�Slicez_Represents a slice object.  This must only be used as argument for
    :class:`Subscript`.
    )�start�stop�stepr�r�r�N)r�r9csJt|���tjttjtjd��fdd�}t||j�||j�||j��S)N)�objr9cs|dkrdS|���S)N)r�)r�)r�rr�constxszSlice.as_const.<locals>.const)	rNrFrGr�rJ�slicer�r�r�)r=r�r�r)r�rr�us
"zSlice.as_const)N)rr r!r"r$rFrGr�r�r6r�r�rrrrr�ks
r�c@s<eZdZUdZdZejeed<dej	e
ed�dd�ZdS)	�ConcatzXConcatenates the list of expressions provided after converting
    them to strings.
    )r�r�N)r�r9cs$t|���d��fdd�|jD��S)NrQc3s|]}t|����VqdS)N)rHr�)rrr�)r�rrrs�sz"Concat.as_const.<locals>.<genexpr>)rNrvr�)r=r�r)r�rr��s
zConcat.as_const)N)
rr r!r"r$rFr�r�r�rGr6rHr�rrrrr��s
r�c@sFeZdZUdZdZeed<ejded<d
ej	e
ejd�dd	�ZdS)�CompareziCompares an expression with some other expressions.  `ops` must be a
    list of :class:`Operand`\s.
    )�expr�opsr��Operandr�N)r�r9c
Cs�t||�}|j�|�}}y<x6|jD],}|j�|�}t|j||�}|sLdS|}q$WWn*tk
r�}zt�|�Wdd}~XYnX|S)NF)rNr�r�r�r�opr�r)r=r�rerr�Z	new_valuer�rrrr��s
zCompare.as_const)N)
rr r!r"r$r�r�rFr�rGr6rJr�rrrrr��s

r�c@s&eZdZUdZdZeed<eed<dS)r�z$Holds an operator and an expression.)r�r�r�r�N)rr r!r"r$rHr�r�rrrrr��s
r�c@seZdZdZdZdS)�Mulz(Multiplies the left with the right node.r
N)rr r!r"r�rrrrr�src@seZdZdZdZdS)�Divz#Divides the left by the right node.rN)rr r!r"r�rrrrr�src@seZdZdZdZdS)�FloorDivzbDivides the left by the right node and converts the
    result into an integer by truncating.
    z//N)rr r!r"r�rrrrr�src@seZdZdZdZdS)�AddzAdd the left to the right node.r
N)rr r!r"r�rrrrr�src@seZdZdZdZdS)�Subz&Subtract the right from the left node.rN)rr r!r"r�rrrrr�src@seZdZdZdZdS)�ModzLeft modulo right.rN)rr r!r"r�rrrrr�src@seZdZdZdZdS)�PowzLeft to the power of right.z**N)rr r!r"r�rrrrr�src@s.eZdZdZdZdejeejd�dd�Z	dS)�AndzShort circuited AND.�andN)r�r9cCs"t||�}|j�|�o |j�|�S)N)rNr�r�r�)r=r�rrrr��s
zAnd.as_const)N)
rr r!r"r�rFrGr6rJr�rrrrr�src@s.eZdZdZdZdejeejd�dd�Z	dS)�OrzShort circuited OR.�orN)r�r9cCs"t||�}|j�|�p |j�|�S)N)rNr�r�r�)r=r�rrrr��s
zOr.as_const)N)
rr r!r"r�rFrGr6rJr�rrrrr	�sr	c@seZdZdZdZdS)�NotzNegate the expression.rN)rr r!r"r�rrrrr�src@seZdZdZdZdS)�NegzMake the expression negative.rN)rr r!r"r�rrrrr�src@seZdZdZdZdS)�Posz8Make the expression positive (noop for most expressions)r
N)rr r!r"r�rrrrr
�sr
c@seZdZUdZdZeed<dS)�EnvironmentAttributez�Loads 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$rHr�rrrrrs
rc@s&eZdZUdZdZeed<eed<dS)�ExtensionAttributez�Returns the attribute of an extension bound to the environment.
    The identifier is the identifier of the :class:`Extension`.

    This node is usually constructed by calling the
    :meth:`~jinja2.ext.Extension.attr` method on an extension.
    )�
identifierr2rr2N)rr r!r"r$rHr�rrrrrs
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$rHr�rrrrrs
rc@s,eZdZUdZdZeed<dd�dd�ZdS)�InternalNamea6An internal name in the compiler.  You cannot create these nodes
    yourself but the parser provides a
    :meth:`~jinja2.parser.Parser.free_identifier` method that creates
    a new identifier for you.  This identifier is not available from the
    template and is not treated specially by the compiler.
    )r2r2N)r9cCstd��dS)NzKCan't create internal names.  Use the `free_identifier` method on a parser.)rR)r=rrrr>2szInternalName.__init__)rr r!r"r$rHr�r>rrrrr's
rc@s6eZdZUdZdZeed<deje	e
d�dd�ZdS)	�MarkSafez:Mark the wrapped expression as safe (wrap it as `Markup`).)r�r�N)r�r9cCst||�}t|j�|��S)N)rNrr�r�)r=r�rrrr�?s
zMarkSafe.as_const)N)rr r!r"r$r�r�rFrGr6rr�rrrrr9s
rc@sBeZdZUdZdZeed<deje	ej
eejfd�dd�Z
dS)	�MarkSafeIfAutoescapez�Mark the wrapped expression as safe (wrap it as `Markup`) but
    only if autoescaping is active.

    .. versionadded:: 2.5
    )r�r�N)r�r9cCs4t||�}|jrt��|j�|�}|jr0t|�S|S)N)rNr<rr�r�r;r)r=r�r�rrrr�Ns
zMarkSafeIfAutoescape.as_const)N)rr r!r"r$r�r�rFrGr6r�rrJr�rrrrrDs


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)�DerivedContextReferencez�Return the current template context including locals. Behaves
    exactly like :class:`ContextReference`, but includes local
    variables, such as from a ``for`` loop.

    .. versionadded:: 2.11
    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.)r�r�N)	rr r!r"r$rFr�rr�rrrrr}s
rc@s,eZdZUdZdZeed<eje	ed<dS)�OverlayScopea�An overlay scope for extensions.  This is a largely unoptimized scope
    that however can be used to introduce completely arbitrary variables into
    a sub scope from a dictionary or dictionary like object.  The `context`
    field has to evaluate to a dictionary object.

    Example usage::

        OverlayScope(context=self.call_method('get_context'),
                     body=[...])

    .. versionadded:: 2.10
    )r�r�r�r�N)
rr r!r"r$r�r�rFr�rrrrrr�s
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$rFr�r�r�rrrrr�s
rc@s$eZdZUdZdZejeed<dS)�ScopedEvalContextModifierz�Modifies the eval context and reverts it later.  Works exactly like
    :class:`EvalContextModifier` but will only modify the
    :class:`~jinja2.nodes.EvalContext` for nodes in the :attr:`body`.
    )r�r�N)	rr r!r"r$rFr�rr�rrrrr�s
rzte.NoReturn)r�r�r9cOstd��dS)Nzcan't create custom node types)rR)r�r�rrr�_failing_new�sr)zr"r�r��typingrF�collectionsrZ
markupsafer�utilsr�
TYPE_CHECKINGZtyping_extensions�ter7r�TypeVarr�mul�truediv�floordiv�pow�mod�add�subrr�rH�CallablerJr��not_�pos�negrrrr�ger�lerr�rr0r#r6rGrNrr�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�r�r�r�r�r�r�r�r�r�r�r�rrrrrrrrr	rrr
rrrrrrrrrrrrrrr�staticmethodr1rrrr�<module>s�0,22		


			.0



		
	



Hacked By AnonymousFox1.0, Coded By AnonymousFox