module documentation

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.
Class ​Add Add the left to the right node.
Class ​And Short circuited AND.
Class ​Assign Assigns an expression to a target.
Class ​Assign​Block Assigns a block to a target.
Class ​Bin​Expr Baseclass for all binary expressions.
Class ​Block A node that represents a block.
Class ​Break Break a loop.
Class ​Call No summary
Class ​Call​Block Like a macro without a name but a call instead. call is called with the unnamed macro as caller argument this node holds.
Class ​Compare Compares an expression with some other expressions. ops must be a list of Operands.
Class ​Concat Concatenates the list of expressions provided after converting them to strings.
Class ​Cond​Expr A conditional expression (inline if expression). ({{ foo if bar else baz }})
Class ​Const No summary
Class ​Context​Reference Returns the current template context. It can be used like a Name node, with a 'load' ctx and will return the current ~jinja2.runtime.Context object.
Class ​Continue Continue a loop.
Class ​Derived​Context​Reference Return the current template context including locals. Behaves exactly like ContextReference, but includes local variables, such as from a for loop.
Class ​Dict Any dict literal such as {1: 2, 3: 4}. The items must be a list of Pair nodes.
Class ​Div Divides the left by the right node.
Class ​Environment​Attribute Loads an attribute from the environment object. This is useful for extensions that want to call a callback stored on the environment.
Class ​Eval​Context Holds evaluation time information. Custom attributes can be attached to it in extensions.
Class ​Eval​Context​Modifier Modifies the eval context. For each option that should be modified, a Keyword has to be added to the options list.
Class ​Expr Baseclass for all expressions.
Class ​Expr​Stmt A statement that evaluates an expression and discards the result.
Class ​Extends Represents an extends statement.
Class ​Extension​Attribute Returns the attribute of an extension bound to the environment. The identifier is the identifier of the Extension.
Class ​Filter Apply a filter to an expression. name is the name of the filter, the other fields are the same as Call.
Class ​Filter​Block Node for filter sections.
Class ​Floor​Div Divides the left by the right node and converts the result into an integer by truncating.
Class ​For No summary
Class ​From​Import No summary
Class ​Getattr Get an attribute or item from an expression that is a ascii-only bytestring and prefer the attribute.
Class ​Getitem Get an attribute or item from an expression and prefer the item.
Class ​Helper Nodes that exist in a specific context only.
Class ​If If test is true, body is rendered, else else_.
Class ​Import A node that represents the import tag.
Class ​Imported​Name No summary
Class ​Impossible Raised if the node could not perform a requested action.
Class ​Include A node that represents the include tag.
Class ​Internal​Name No summary
Class ​Keyword A key, value pair for keyword arguments where key is a string.
Class ​List Any list literal such as [1, 2, 3]
Class ​Literal Baseclass for literals.
Class ​Macro 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.
Class ​Mark​Safe Mark the wrapped expression as safe (wrap it as Markup).
Class ​Mark​Safe​If​Autoescape Mark the wrapped expression as safe (wrap it as Markup) but only if autoescaping is active.
Class ​Mod Left modulo right.
Class ​Mul Multiplies the left with the right node.
Class ​Name Looks up a name or stores a value in a name. The ctx of the node can be one of the following values:
Class ​Neg Make the expression negative.
Class ​Node Baseclass for all Jinja nodes. There are a number of nodes available of different types. There are four major types:
Class ​Not Negate the expression.
Class ​NSRef Reference to a namespace value assignment
Class ​Operand Holds an operator and an expression.
Class ​Or Short circuited OR.
Class ​Output A node that holds multiple expressions which are then printed out. This is used both for the print statement and the regular template data.
Class ​Overlay​Scope No summary
Class ​Pair A key, value pair for dicts.
Class ​Pos Make the expression positive (noop for most expressions)
Class ​Pow Left to the power of right.
Class ​Scope An artificial scope.
Class ​Scoped​Eval​Context​Modifier Modifies the eval context and reverts it later. Works exactly like EvalContextModifier but will only modify the ~jinja2.nodes.EvalContext for nodes in the body.
Class ​Slice Represents a slice object. This must only be used as argument for Subscript.
Class ​Stmt Base node for all statements.
Class ​Sub Subtract the right from the left node.
Class ​Template Node that represents a template. This must be the outermost node that is passed to the compiler.
Class ​Template​Data A constant template string.
Class ​Test Apply a test to an expression. name is the name of the test, the other field are the same as Call.
Class ​Tuple For loop unpacking and some other things like multiple arguments for subscripts. Like for Name ctx specifies if the tuple is used for loading the names or storing.
Class ​Unary​Expr Baseclass for all unary expressions.
Class ​With Specific node for with statements. In older versions of Jinja the with statement was implemented on the base of the Scope node instead.
Class _​Filter​Test​Common Undocumented
Class ​Node​Type A metaclass for nodes that handles the field and attribute inheritance. fields and attributes from the parent class are automatically forwarded to the child.
Function ​_failing​_new Undocumented
Function args​_as​_const Undocumented
Function get​_eval​_context Undocumented
Variable ​_binop​_to​_func Undocumented
Variable ​_cmpop​_to​_func Undocumented
Variable _​Node​Bound Undocumented
Variable ​_uaop​_to​_func Undocumented
def _failing_new(*args, **kwargs):

Undocumented

Parameters
*args:t.AnyUndocumented
**kwargs:t.AnyUndocumented
Returns
te.NoReturnUndocumented
def args_as_const(node, eval_ctx):

Undocumented

Parameters
node:t.Union[_FilterTestCommon, Call]Undocumented
eval​_ctx:t.Optional[EvalContext]Undocumented
Returns
t.Tuple[t.List[t.Any], t.Dict[t.Any, t.Any]]Undocumented
def get_eval_context(node, ctx):

Undocumented

Parameters
node:NodeUndocumented
ctx:t.Optional[EvalContext]Undocumented
Returns
EvalContextUndocumented
_binop_to_func: t.Dict[str, t.Callable[[t.Any, t.Any], t.Any]] =

Undocumented

_cmpop_to_func: t.Dict[str, t.Callable[[t.Any, t.Any], t.Any]] =

Undocumented

_NodeBound =

Undocumented

_uaop_to_func: t.Dict[str, t.Callable[[t.Any], t.Any]] =

Undocumented