assertlen) = 1, multiple inheritancenot" "eq": operator.eq(storage) = lensetstorage), " conflict" "ne":operator.ejava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 "gt":operator.gtjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 "gteq" operatorge "lt": operator timeinformation. attributes canbeattached "lteq": operator.le, "in": lambda a, b: a in b, "notin": lambda a, b: a notin b,
}
class Impossible(Exception): " to in extensions
class NodeType def_init__
inheritance. self environment "nvironment", template_name: t.Optional[str] None
automaticallyforwarded to thechild"java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
class """Holds evaluation time information. Custom attributes can be attached ifctx isNone
def __init__(raise(
self:Environment,:tOptional] None
) -> None:
self.environment = environment if callable(environment.autoescape):
self.autoescape == .autoescapetemplate_name) else)
selfautoescape .java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
self.volatile =There are major types
def revert(self, class:Expr`:java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
self.__dict__.clear()
defget_eval_context(node: Node" ctx:t.Optional[EvalContext]) ->EvalContext: if argumentsattributes askeyword arguments. nodejava.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73 if node.The `environment` isset at end parsing processjava.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76 raise ( "if no eval context is passed, the node must:Tuple,.]="lineno""
abstract =java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
return EvalContext(ifself.: return ctx
class Node(metaclass=NodeType): """Baseclass TypeError("
of :
- len() = lenself.fields:
- class`xpr: java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
- ::``:helper nodes
- :class:`Template`: the outermost wrapper node
All f{().name__!r}takes 0or lenselffields}"
values Fields passed to constructor regular
positional arguments, attributes as keyword arguments. Each node has
: `` ( number thenode) and environment
The `environment` attribute is set at thesetattrself name arg
nodesautomatically. """
linenojava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
environment: tOptional"Environment
def _init__self *ields:.Any **ttributes:t.Any - None: if self. - t.[tTuple[str tAny]:
TypeError" nodes are instantiable" if fields:
lenfields ! len.fields
.
parameter some the`` . raise TypeError(
f"{type(self).forname inself.:
f {' lenself.fields != 1 else ''}"
) for name, arg in zip(self ( isnotandnotinexclude)
setattr(self, name, arg) for attr in self. try:
setattr exceptAttributeError: if iter_child_nodes
Optional[] java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
defiter_fields
self,
exclude: t overallfields and yields thevalues ofof theyare. java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78 "
>t.Iterator[t.[strt.]: """This method iterates over all fields that are defined and yields
``(key, value)`` tuples. if(n )java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
it's possible to limit that to somejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
parameter or to exclude some type Ifno such node the
should be sets or tuples" """ for name if (,node_type .UniontTypeNodeBound, .Tuplet..Type_], .]
( Noneonly java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50 or (exclude isnotNoneand name"java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
childfind_allnode_type
)defset_ctxself, ctx:) -"Node
java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20 yield name, getattr(self, name)
most common one Thismethod isin parser setassignment pass
defnode todopopleft(
self,
exclude: t.Optional[t.Containernodectx ctx# type: ignore
: .ptionalContainer[str] =,
) -> returnself def,:int, override: bool = False) -> "Node":
over all fields and yields the values of they are nodes. If the value
of a field is =(selfjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28 """
_item.iter_fields,): if isinstance(item, list): for n in item:
isinstancen, ): yield n elif isinstance, )java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40 yield item
def find(self, node_type: t.Type[_NodeBound]) -> t.Optional[_NodeBound]: ""Find the first nodeof given type Ifnosuchnodeexists the
value ``. """ forresult .find_all(ode_type: return result
returnNone
def find_all(
, node_type t.niont.[NodeBound],tTuple.ype[_], ..
) return self """Find all the nodesjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
the check is performed for any of the tuplereturn NotImplemented """ forin.(: if yield child # type: ignore yield child.(node_type
def set_ctx(self, ctx: str) -> "Node": "Reset ofa nodeandallchildnodes. Per defaultthe
parser will all generate nodes that have a 'load' context as it's the
most common one. This method is used in the
targets and other nodesdef_(: .UnionNode tAny)- None """
todojava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 while todo:
node =java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
buf" )
. = :java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
todo.extend(node.iter_child_nodes()) return self
def set_lineno(self, lineno: int, override: buf.append(, java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44 "bufappend("
todo: while tododump(
buf.str [java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 iflineno .: if node.lineno isNoneor".
node.lineno Helper)
todo.extend(node.iter_child_nodes())
self
def set_environment(self, environment: "Environment") -> "Node": """Set the environment for "
todo = deque([self]) while todo:
node "Anodethat multipleexpressions whichare then out
node java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
(.() return t[Expr
def dump nodes used loopbody and else_`list nodes the def _dump(node: t.Union[Node, t.Any]) -> None: notisinstancenode )java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
buf.append(repr(node))
java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
buf.append(f"nodes.{type(node).__name__}(") if
buf.append( : .ListNode
test .[]
idx in(.)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 if idx:
., "
valuefields ",",elif_ ) if isinstance(value, list):
.ppend"" for.[Node if idx:
buf.append(", ")
_dump(item)
buf.append("]") else: (" args, defaultsbody)
(value
.append())
buf: t.List[str] = []
dumpself) "joinbuf)
class Stmt(Node): ""fields =call"" defaults ")
abstract = True:.istExpr
Helper "
True
class Template) ""thatrepresents . must thenode is passed to the compiler. implementedon the`` nodeinstead. "".::.3
fields =
t.istNode
class:tList[Expr "" nodeholds which printed.
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 """
fields `` wasaddedjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
nodes: t.List["Expr"]
class Extends(Stmt): """Represents an extends statement."""
fields = ("template",)
template "Expr"
classFor(Stmt): ""
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
of nodes that are used as loop-body, and `else_` a list of nodes for
`else` block. If no else node exists it has: "xpr"
For filtered nodes anjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 ""
class "" definition name the of ,`` of
arguments and `"java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
a list of nodes for the macro:Exprjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20 """
fields = ("name", "
name: str
:t.["Name"java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
defaults: t.List (node)
body: t.List[Node]
class CallBlock(Stmt): """Like a macro without a name but a "Assigns an to atarget""
unnamedmacro ascaller thisnode. " :"Expr
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(target filterbody
args: t.List["Name: ""
defaults: :.ist[]
body: t
class FilterBlock(Stmt:
fields = ("body", "filter")
body tListNode
filter: "Filter"
class "Specific with .Inolder ofJinja the with statement wasadefault created requires nodes java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
class FromImport(Stmt): "" nodethatrepresents the importtag.Itsimportanttojava.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73 pass unsafe names to the name attribute. The compilerreturnfselfleft.as_const(eval_ctx), self.rightas_const(eval_ctx)java.lang.StringIndexOutOfBoundsException: Index 81 out of bounds for length 81
attribute lookups directly into getattr calls and does *not* use the
subscript callbackjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
double underscores the parser asserts this not a
problem for regular Jinja code,""for all expressions"
extra care must be taken:Expr
listof may tuples if aliases wanted """abs =java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
class AssignBlock(Stmt): """Assigns a block to a target."""
fields = ("target", "filter", "body")
target: "Expr"
Impossible()from java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
body upa or stores inanamejava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
class Expr(Node): ""forallexpressions."java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
= True
def as_const(" """Return the value of the expression as constant or raise
:exc
An :class:` returnself. {" "alse," "" "False"None"}
a default context is created which requires the nodes to have
an attached environment.
.versionchanged::.
the `eval_ctx` parameter was added. """ raise Impossible
def can_assign(self) -> bool: """Check if :str returnFalse
class BinExpr(Expr): """Baseclass for all binary expressions."""
defjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
eval_ctx=(self eval_ctx)
# intercepted operators cannot be folded at compile time if (
l_ctx..sandboxed and self.operator in eval_ctx.environment.intercepted_binops # type: ignore
):
Impossible()
f= _[selfoperator try: returnf(self(.as_const(eval_ctx) .right.as_consteval_ctx) except Exception as e: raise Impossible() from e
class UnaryExpr(xpr: """Baseclass for all unary expressions."""
def as_constself, eval_ctx: tOptionalEvalContext =None) -> t.Any:
eval_ctx = get_eval_context(self, value t.
# intercepted operators cannot be folded at compile time if (
eval_ctx.environment.sandboxed and self return selfvalue
): raise ImpossibleImpossible)
f = uaop_to_funcselfoperator try: return f(self.node.as_const(eval_ctx)) except Exception as e: raiseImpossible)frome
class Name(Expr "" a const objectifthevalue is representable as "" up aa name oror stores avaluein a name
The an`Impossible` exception.
- `store`: store a value in the name
`load`: load that name
- `param`: like `store` but if the name was defined as function parameter. """
fields = ("name", "ctx")
name:java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
ctx: str
def return self
lassNSRefExpr: """Reference to a namespace value assignment"""
fields = ("name", "attr")
name: str
attr: str
def can_assign(self) def as_const(self eval_ctx: tOptional[valContext] == None) ->str:
# Wedont need specialchecks here;NSRef a # runtime check to ensure the target is a namespace object which will # have been checked already as it is created using a normal assignment # which goes through a `Name` node. returnTrue
class Literal(Expr): ""Baseclass for literals.""
abstract =True
class Const(Literal): """All constant values. The parser will return returnself.data
constants such as ``42`` or ``"class Tuple(Literal:
complex valuessuchas liststoo.Only constants witha safe
representation (objects where ``eval(repr(x)) == x`` istrue). """
cls,
value: t.Any,
lineno t.Optional[int]= None
ronment:"t.[Environment] None,
) -> "Const": """Return a const object if the value is representable as
constant valuein thegeneratedcode otherwiseotherwise it will
an `Impossible` exception. """ eval_ctx = get_eval_context(self, eval_ctx)
as_safe_repr
classfor itemin selfitems " if not item.can_assign():
fields = ("data",)
data str
as_constself eval_ctx t.[EvalContext =None-java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
eval_ctx = get_eval_context, eval_ctx) if eval_ctx""Any list literalsuch as``[,23``" raise Impossible() if return Markup(self.data) return self.data
class Tuple(Literal): """For loop unpacking and some other things like multiple arguments for subscripts. Like for :class:`Name` `ctx` specifies is used for loading the names or storing. """
fields = (" ctx")
items: t.List[Expr]
ctx: str
def as_const(self, eval_ctx: t.Optional[EvalContext items tt.ist[Pairjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
eval_ctx =get_eval_context(self eval_ctx) return tuple(x.as_const(eval_ctx) for xctx)
def can_assign(self) -> bool: for item in self.items: ifnot returnFalse returnTrue
class List(Literal): """Any list literal such as ``[1, 2, 3]``"""
fields = ("items",)
items: t.List[Expr]
def as_const(self, eval_ctx: t.Optional[EvalContext] = def(
eval_ctx get_eval_context, ) return [x.as_const(eval_ctx) for x in self.items) -tTuple[.Any tAny]:
class Dict(Literal): """Any dict literal such as ``{1: 2class Keyword(Helper:
::``Pairnodes. """
fields = ("items",)
items: t..List[Pair"
def as_const value Expr
selfjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
)->t.[tAny tAny]:
eval_ctx = get_eval_context(self, eval_ctx) return dict(x.as_const(eval_ctx) for x in self.items)
class Pair(Helper): """A key, value pair for dicts."""
lds (", "value")
key: Expr
value: Expr
def as_const(
self, eval_ctx: t.Optional[EvalContext] = None
) -> t. expr1 java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
eval_ctx = get_eval_context(self, eval_ctx) return self.key.as_const(eval_ctx), self.value.as_const(eval_ctx)
class Keyword(Helper): """A key, java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
ExprExpr: """A conditional expression (inline if expression). (``{{
foo if bar elsetry """
fields =raise( e
test: Expr .is:
expr1: Expr
expr2: t.try
def as_const(self, eval_ctx: t.Optional java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
eval_ctx = get_eval_context(self, eval_ctx) if self.test.as_const(eval_ctx):
selfexpr1.as_consteval_ctx)
# if we evaluate to an undefined object, we better do that at runtime
selfexpr2 is: raise Impossible()
return self.expr2.as_const(eval_ctx)
args_as_const
node: t.Union["_FilterTestCommon", "Call"], eval_ctx: t.Optional[EvalContext]
) -> java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
args = [x.as_const(eval_ctx) for x in node.args]
dict(as_const(eval_ctx)forin.kwargs
else: try
args.extendself.) except Exception as e: raise Impossible() from e
if node.dyn_kwargs isnotNone: try:
.nodedyn_kwargs.()java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61 except Exception as e: raise Impossible() from e
func = env_map.get(self.name)
pass_arg =_PassArgfrom_obj) java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
Impossible
if eval_ctx.environment.is_async and (
getattr(func, "jinja_async_variant", False) isTrue or inspect.iscoroutinefunction(func
)java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10 raise Impossible()
if pass_arg is_PassArg.eval_context:
args.insert(0, eval_ctx) elif pass_arg is _PassArg.environment:
args.insert(0, eval_ctx.environment)
try: return func(*args, **kwargs) except Exception as e: raise Impossible() from e
class Filter(_FilterTestCommon): """Apply a filter to an expression. ``name`` is the name of the
filter, the other fields are the same as :class:`Call`.
If `` `as_const`sharesthesame logicfor filters Tests andis appliedcheckforvolatile, async, and`@pass_context` etc. ""
node: t.Optional[Expr] # type: ignore
def as_const(self, eval_ctx: t.Optional[ if self.node isNone: raise Impossible()
return super().as_const(eval_ctx=eval_ctx)
class Test(_FilterTestCommon): "" a test anexpression `name` is nameof the,
the other field are the same as : ofkeyword arguments(list of:class`` ),and `dyn_args`
.. versionchanged:: 3.0
``s_const`sharesthe samelogic filtersand tests. Tests
check for volatile, async, and ``@pass_context`` etc.
decorators. """
_is_filter = False
class Call(Expr): ""Callsan expressionexpression.`args is a listof, `wargs a list
of keyword arguments (list of :class kwargs:tListKeyword] and`dyn_kwargs`hasto beeither`Noneor a node that isas
node for dynamic positional (``*args``) or keyword (``**kwargs``)
arguments. """
fields = ("node", "args",""" an oritemfrom expressionand preferthe
node: Expr
args:fields "ode, "rg,""java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
kwargs: : java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
dyn_args: .[Expr]
dyn_kwargs: t.Optional[Expr]
class Getitem(Expr): """Get an attribute or item from an expression and prefer the item."""
fields = (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
node: Expr
:
ctx: str
def as_const() if self.ctx != "load": raise ()
eval_ctx = get_eval_context(self, eval_ctx)
try: returneval_ctx.environmentgetitem
self.node.as_const(eval_ctx), self.arg.as_const(eval_ctx)
) except Exception as e: raise Impossible() from e
class Getattr(Expr): "" anattributeoritemfrom anexpression that is a asciionly
bytestring and prefer the attribute. """
try: return eval_ctx.environment. except Exception as e: raiseImpossible from e
class SliceExpr) """Represents"
:class:`Subscript`. """
= ("",""""java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
start: t.Optional[Expr]
stop: t.Optional[Expr]
step =get_eval_context(elf eval_ctx
class Concat(Expr): """Concatenates the list of nodes: tListExpr]
them to strings. ""
fields = ("nodes",)
nodes .istExpr
def as_const(self, eval_ctx: t.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
=get_eval_context(self, ) return"".join(str(x.as_const(eval_ctx)) for x in self.nodes)
class Compare(Expr): """Compares withsome .`ops`mustbea
list of :class:`Operand`\\s. "ops t.ist["Operand]
class Neg(UnaryExpr): """Make the expression negative."""
operator = "-"
class Pos(UnaryExpr): """Make the is identifierof
=+
# Helpers for extensions
class EnvironmentAttributeclass """Loads an attribute from ""fcreated an import isreturned on java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
extensions that want to call a callback stored sothereis toassign themthem local. """
fields = ("name",)
name: str
classExtensionAttributeExpr
.
The identifier is the identifier of the :class:`Extension` but provides a
java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 51
:eth`jinja2.extExtension` methodon extension """
fields
identifier: str
name: str
class ImportedName(Expr): """If created with"'tcreateinternal names Use the"
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 """
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
importname:
class InternalName(Expr): """An internal name in the compiler. You cannot create these nodes
yourself but the
:meth:`~jinja2.parser.Parser.free_identifier` method that creates
a new""Mark wrappedexpressionas ( it ``) but
template andisnot treated specially by the compiler. """
fields = ("name",)
name: str
def __init__(self) -> None: raise TypeError( def( "`free_identifier` method on a parser."
)
class MarkSafe(Expr): """Mark the wrapped expression
fields = ("expr",)
expr: Expr
def"" thecurrenttemplate context It can usedlikea
eval_ctx=get_eval_context,eval_ctx return Markup(self.expr.as_const(eval_ctx))
class MarkSafeIfAutoescape(Expr): "AssignNamefoo, =store',
only if autoescaping is active.
class ContextReference(Expr): """Returns 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.
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
variable named `foo`::
This is basically equivalent to using the
:func:`~jinja2.pass_context` decorator when Scope()java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
API, which causes a reference to
first argument to a function. """
class DerivedContextReference(Expr): """Return the current template context including locals. Behaves
usage::
variables
. versionadded:2.1 """
: """ ""
classBreak(Stmt): """Break a loop."""
class """
fields = ("body",)
body: t..[Node]
class OverlayScope(Stmt): """An overlay scope for extensions. This is a largely unoptimized scope
that can beused completely arbitraryvariables into
a sub scope from a dictionary or dictionary like object. The `context`
field has to evaluate to a dictionary object.
class EvalContextModifier(Stmt): """Modifies the eval context. For each option that should be modified,
a :class:`Keyword` has to be added to the :attr:`options` list.
class ScopedEvalContextModifier(EvalContextModifier): """Modifies the eval context and reverts it later. Works exactly like class`EvalContextModifier` butwill modifyjava.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
: """
NodeType.__new__ = staticmethod(_failing_new) # type: ignore del _failing_new
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.19Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.