sdkagent

jinja API reference

272 public APIs from jinja (pallets/jinja) — 100 classes, 55 functions, 117 methods. Signatures extracted by static analysis of the actual source.

Repository: pallets/jinja

KindCount
Classes100
Functions55
Methods117

API list

classsrc.jinja2.bccache.Bucket
Buckets are used to store the bytecode for one template.
methodsrc.jinja2.bccache.Bucket.bytecode_from_string(string:bytes) -> None
Load bytecode from bytes.
methodsrc.jinja2.bccache.Bucket.bytecode_to_string() -> bytes
Return the bytecode as bytes.
methodsrc.jinja2.bccache.Bucket.load_bytecode(f:t.BinaryIO) -> None
Loads bytecode from a file or file like object.
methodsrc.jinja2.bccache.Bucket.reset() -> None
Resets the bucket (unloads the bytecode).
methodsrc.jinja2.bccache.Bucket.write_bytecode(f:t.IO[bytes]) -> None
Dump the bytecode into the file or file like object passed.
classsrc.jinja2.bccache.FileSystemBytecodeCache
A bytecode cache that stores bytecode on the filesystem.
methodsrc.jinja2.compiler.CodeGenerator.blockvisit(nodes:t.Iterable[nodes.Node], frame:Frame) -> None
Visit a list of nodes as block in a frame.
methodsrc.jinja2.compiler.CodeGenerator.buffer(frame:Frame) -> None
Enable buffering for the frame from that point onwards.
methodsrc.jinja2.compiler.CodeGenerator.end_write(frame:Frame) -> None
End the writing process started by `start_write`.
methodsrc.jinja2.compiler.CodeGenerator.fail(msg:str, lineno:int) -> 'te.NoReturn'
Fail with a :exc:`TemplateAssertionError`.
methodsrc.jinja2.compiler.CodeGenerator.indent() -> None
Indent by one.
methodsrc.jinja2.compiler.CodeGenerator.macro_body(node:nodes.Macro | nodes.CallBlock, frame:Frame) -> tuple[Frame, MacroRef]
Dump the function def of a macro or call block.
methodsrc.jinja2.compiler.CodeGenerator.macro_def(macro_ref:MacroRef, frame:Frame) -> None
Dump the macro definition for the def created by macro_body.
methodsrc.jinja2.compiler.CodeGenerator.newline(node:nodes.Node | None=None, extra:int=0) -> None
Add one or more newlines before the next write.
methodsrc.jinja2.compiler.CodeGenerator.outdent(step:int=1) -> None
Outdent by step.
methodsrc.jinja2.compiler.CodeGenerator.parameter_is_undeclared(target:str) -> bool
Checks if a given target is an undeclared parameter.
methodsrc.jinja2.compiler.CodeGenerator.pop_parameter_definitions() -> None
Pops the current parameter definitions set.
methodsrc.jinja2.compiler.CodeGenerator.position(node:nodes.Node) -> str
Return a human readable position for the node.
methodsrc.jinja2.compiler.CodeGenerator.push_assign_tracking() -> None
Pushes a new layer for assignment tracking.
methodsrc.jinja2.compiler.CodeGenerator.return_buffer_contents(frame:Frame, force_unescaped:bool=False) -> None
Return the buffer contents of the frame.
methodsrc.jinja2.compiler.CodeGenerator.simple_write(s:str, frame:Frame, node:nodes.Node | None=None) -> None
Simple shortcut for start_write + write + end_write.
methodsrc.jinja2.compiler.CodeGenerator.start_write(frame:Frame, node:nodes.Node | None=None) -> None
Yield or write into the frame buffer.
methodsrc.jinja2.compiler.CodeGenerator.temporary_identifier() -> str
Get a new unique identifier.
methodsrc.jinja2.compiler.CodeGenerator.visit_Block(node:nodes.Block, frame:Frame) -> None
Call a block and register it for the template.
methodsrc.jinja2.compiler.CodeGenerator.visit_Extends(node:nodes.Extends, frame:Frame) -> None
Calls the extender.
methodsrc.jinja2.compiler.CodeGenerator.visit_FromImport(node:nodes.FromImport, frame:Frame) -> None
Visit named imports.
methodsrc.jinja2.compiler.CodeGenerator.visit_Import(node:nodes.Import, frame:Frame) -> None
Visit regular imports.
methodsrc.jinja2.compiler.CodeGenerator.visit_Include(node:nodes.Include, frame:Frame) -> None
Handles includes.
methodsrc.jinja2.compiler.CodeGenerator.write(x:str) -> None
Write a string into the output stream.
methodsrc.jinja2.compiler.CodeGenerator.writeline(x:str, node:nodes.Node | None=None, extra:int=0) -> None
Combination of newline and write.
classsrc.jinja2.compiler.DependencyFinderVisitor
A visitor that collects filter and test calls.
methodsrc.jinja2.compiler.DependencyFinderVisitor.visit_Block(node:nodes.Block) -> None
Stop visiting at blocks.
classsrc.jinja2.compiler.Frame
Holds compile time information for us.
methodsrc.jinja2.compiler.Frame.copy() -> 'te.Self'
Create a copy of the current one.
methodsrc.jinja2.compiler.Frame.inner(isolated:bool=False) -> 'Frame'
Return an inner frame.
methodsrc.jinja2.compiler.Frame.soft() -> 'te.Self'
Return a soft frame.
classsrc.jinja2.compiler.VisitorExit
Exception used by the `UndeclaredNameVisitor` to signal a stop.
funcsrc.jinja2.compiler.find_undeclared(nodes:t.Iterable[nodes.Node], names:t.Iterable[str]) -> set[str]
Check if the names passed are accessed undeclared.
funcsrc.jinja2.compiler.has_safe_repr(value:t.Any) -> bool
Does the node have a safe representation?
classsrc.jinja2.environment.Environment
The core component of Jinja is the `Environment`.
methodsrc.jinja2.environment.Environment.add_extension(extension:str | type['Extension']) -> None
Adds an extension after the environment was created.
methodsrc.jinja2.environment.Environment.extend(**attributes:t.Any) -> None
Add the items to the instance of the environment if they do not exist yet.
methodsrc.jinja2.environment.Environment.getattr(obj:t.Any, attribute:str) -> t.Any
Get an item or attribute of an object but prefer the attribute.
methodsrc.jinja2.environment.Environment.getitem(obj:t.Any, argument:str | t.Any) -> t.Any | Undefined
Get an item or attribute of an object but prefer the item.
methodsrc.jinja2.environment.Environment.handle_exception(source:str | None=None) -> 'te.NoReturn'
Exception handling helper.
methodsrc.jinja2.environment.Environment.iter_extensions() -> t.Iterator['Extension']
Iterates over the extensions by priority.
methodsrc.jinja2.environment.Environment.join_path(template:str, parent:str) -> str
Join a template with the parent.
methodsrc.jinja2.environment.Environment.lexer() -> Lexer
The lexer for this environment.
methodsrc.jinja2.environment.Environment.make_globals(d:t.MutableMapping[str, t.Any] | None) -> t.MutableMapping[str, t.Any]
Make the globals map for a template.
methodsrc.jinja2.environment.Environment.parse(source:str, name:str | None=None, filename:str | None=None) -> nodes.Template
Parse the sourcecode and return the abstract syntax tree.
methodsrc.jinja2.environment.Environment.preprocess(source:str, name:str | None=None, filename:str | None=None) -> str
Preprocesses the source with all extensions.
classsrc.jinja2.environment.Template
A compiled template that can be rendered.
methodsrc.jinja2.environment.Template.debug_info() -> list[tuple[int, int]]
The debug info mapping.
methodsrc.jinja2.environment.Template.from_module_dict(environment:Environment, module_dict:t.MutableMapping[str, t.Any], globals:t.MutableMapping[str, t.Any]) -> 'Template'
Creates a template object from a module.
methodsrc.jinja2.environment.Template.generate_async(*args:t.Any, **kwargs:t.Any) -> t.AsyncGenerator[str, object]
An async version of :meth:`generate`.
methodsrc.jinja2.environment.Template.module() -> 'TemplateModule'
The template as module.
methodsrc.jinja2.environment.Template.new_context(vars:dict[str, t.Any] | None=None, shared:bool=False, locals:t.Mapping[str, t.Any] | None=None) -> Context
Create a new :class:`Context` for this template.
classsrc.jinja2.environment.TemplateModule
Represents an imported template.
funcsrc.jinja2.environment.create_cache(size:int) -> t.MutableMapping[tuple['weakref.ref[BaseLoader]', str], 'Template'] | None
Return the cache class for the given size.
funcsrc.jinja2.environment.get_spontaneous_environment(cls:type[_env_bound], *args:t.Any) -> _env_bound
Return a new spontaneous environment.
classsrc.jinja2.exceptions.TemplateError
Baseclass for all template errors.
classsrc.jinja2.exceptions.TemplateNotFound
Raised if a template does not exist.
classsrc.jinja2.exceptions.TemplateRuntimeError
A generic runtime error in the template engine.
classsrc.jinja2.exceptions.UndefinedError
Raised if a template tries to operate on :class:`Undefined`.
methodsrc.jinja2.ext.Extension.attr(name:str, lineno:int | None=None) -> nodes.ExtensionAttribute
Return an attribute node for the current extension.
methodsrc.jinja2.ext.Extension.bind(environment:Environment) -> 'te.Self'
Create a copy of this extension bound to another environment.
classsrc.jinja2.ext.InternationalizationExtension
This extension adds gettext support to Jinja.
methodsrc.jinja2.ext.InternationalizationExtension.parse(parser:'Parser') -> nodes.Node | list[nodes.Node]
Parse a translatable tag.
classsrc.jinja2.ext.LoopControlExtension
Adds break and continue to the template engine.
funcsrc.jinja2.filters.do_attr(environment:'Environment', obj:t.Any, name:str) -> Undefined | t.Any
Get an attribute of an object.
funcsrc.jinja2.filters.do_batch(value:'t.Iterable[V]', linecount:int, fill_with:'V | None'=None) -> 't.Iterator[list[V]]'
A filter that batches items.
funcsrc.jinja2.filters.do_capitalize(s:str) -> str
Capitalize a value.
funcsrc.jinja2.filters.do_center(value:str, width:int=80) -> str
Centers the value in a field of a given width.
funcsrc.jinja2.filters.do_dictsort(value:t.Mapping[K, V], case_sensitive:bool=False, by:'te.Literal["key", "value"]'='key', reverse:bool=False) -> list[tuple[K, V]]
Sort a dict and yield (key, value) pairs.
funcsrc.jinja2.filters.do_filesizeformat(value:str | float | int, binary:bool=False) -> str
Format the value like a 'human-readable' file size (i.e.
funcsrc.jinja2.filters.do_float(value:t.Any, default:float=0.0) -> float
Convert the value into a floating point number.
funcsrc.jinja2.filters.do_forceescape(value:'str | HasHTML') -> Markup
Enforce HTML escaping.
funcsrc.jinja2.filters.do_int(value:t.Any, default:int=0, base:int=10) -> int
Convert the value into an integer.
funcsrc.jinja2.filters.do_last(environment:'Environment', seq:'t.Reversible[V]') -> 'V | Undefined'
Return the last item of a sequence.
funcsrc.jinja2.filters.do_lower(s:str) -> str
Convert a value to lowercase.
funcsrc.jinja2.filters.do_mark_unsafe(value:str) -> str
Mark a value as unsafe.
funcsrc.jinja2.filters.do_max(environment:'Environment', value:'t.Iterable[V]', case_sensitive:bool=False, attribute:str | int | None=None) -> 'V | Undefined'
Return the largest item from the sequence.
funcsrc.jinja2.filters.do_min(environment:'Environment', value:'t.Iterable[V]', case_sensitive:bool=False, attribute:str | int | None=None) -> 'V | Undefined'
Return the smallest item from the sequence.
funcsrc.jinja2.filters.do_pprint(value:t.Any) -> str
Pretty print a variable.
funcsrc.jinja2.filters.do_random(context:'Context', seq:'t.Sequence[V]') -> 'V | Undefined'
Return a random item from the sequence.
funcsrc.jinja2.filters.do_round(value:float, precision:int=0, method:'te.Literal["common", "ceil", "floor"]'='common') -> float
Round the number to a given precision.
funcsrc.jinja2.filters.do_striptags(value:'str | HasHTML') -> str
Strip SGML/XML tags and replace adjacent whitespace by one space.
funcsrc.jinja2.filters.do_title(s:str) -> str
Return a titlecased version of the value.
funcsrc.jinja2.filters.do_trim(value:str, chars:str | None=None) -> str
Strip leading and trailing characters, by default whitespace.
funcsrc.jinja2.filters.do_truncate(env:'Environment', s:str, length:int=255, killwords:bool=False, end:str='...', leeway:int | None=None) -> str
Return a truncated copy of the string.
funcsrc.jinja2.filters.do_upper(s:str) -> str
Convert a value to uppercase.
funcsrc.jinja2.filters.do_urlencode(value:str | t.Mapping[str, t.Any] | t.Iterable[tuple[str, t.Any]]) -> str
Quote data for use in a URL path or query using UTF-8.
funcsrc.jinja2.filters.do_wordcount(s:str) -> int
Count the words in that string.
funcsrc.jinja2.filters.do_wordwrap(environment:'Environment', s:str, width:int=79, break_long_words:bool=True, wrapstring:str | None=None, break_on_hyphens:bool=True) -> str
Wrap a string to the given width.
funcsrc.jinja2.filters.ignore_case(value:V) -> V
For use as a postprocessor for :func:`make_attrgetter`.
funcsrc.jinja2.filters.sync_do_first(environment:'Environment', seq:'t.Iterable[V]') -> 'V | Undefined'
Return the first item of a sequence.
funcsrc.jinja2.filters.sync_do_list(value:'t.Iterable[V]') -> 'list[V]'
Convert the value into a list.
classsrc.jinja2.idtracking.FrameSymbolVisitor
A visitor for `Frame.inspect`.
methodsrc.jinja2.idtracking.FrameSymbolVisitor.visit_Assign(node:nodes.Assign, **kwargs:t.Any) -> None
Visit assignments in the correct order.
methodsrc.jinja2.idtracking.FrameSymbolVisitor.visit_AssignBlock(node:nodes.AssignBlock, **kwargs:t.Any) -> None
Stop visiting at block assigns.
methodsrc.jinja2.idtracking.FrameSymbolVisitor.visit_Block(node:nodes.Block, **kwargs:t.Any) -> None
Stop visiting at blocks.
methodsrc.jinja2.idtracking.FrameSymbolVisitor.visit_For(node:nodes.For, **kwargs:t.Any) -> None
Visiting stops at for blocks.
methodsrc.jinja2.idtracking.FrameSymbolVisitor.visit_Name(node:nodes.Name, store_as_param:bool=False, **kwargs:t.Any) -> None
All assignments to names go through this function.
methodsrc.jinja2.idtracking.FrameSymbolVisitor.visit_OverlayScope(node:nodes.OverlayScope, **kwargs:t.Any) -> None
Do not visit into overlay scopes.
methodsrc.jinja2.idtracking.FrameSymbolVisitor.visit_Scope(node:nodes.Scope, **kwargs:t.Any) -> None
Stop visiting at scopes.
classsrc.jinja2.lexer.Failure
Class that raises a `TemplateSyntaxError` if called.
classsrc.jinja2.lexer.Lexer
Class that implements a lexer for a given environment.
methodsrc.jinja2.lexer.Token.test(expr:str) -> bool
Test a token against a token expression.
classsrc.jinja2.lexer.TokenStream
A token stream is an iterable that yields :class:`Token`\s.
methodsrc.jinja2.lexer.TokenStream.close() -> None
Close the stream.
methodsrc.jinja2.lexer.TokenStream.eos() -> bool
Are we at the end of the stream?
methodsrc.jinja2.lexer.TokenStream.expect(expr:str) -> Token
Expect a given token type and return it.
methodsrc.jinja2.lexer.TokenStream.look() -> Token
Look at the next token.
methodsrc.jinja2.lexer.TokenStream.next_if(expr:str) -> Token | None
Perform the token test and return the token if it matched.
methodsrc.jinja2.lexer.TokenStream.push(token:Token) -> None
Push a token back to the stream.
methodsrc.jinja2.lexer.TokenStream.skip(n:int=1) -> None
Got n tokens ahead.
methodsrc.jinja2.lexer.TokenStream.skip_if(expr:str) -> bool
Like :meth:`next_if` but only returns `True` or `False`.
classsrc.jinja2.lexer.TokenStreamIterator
The iterator for tokenstreams.
funcsrc.jinja2.lexer.compile_rules(environment:'Environment') -> list[tuple[str, str]]
Compiles all the rules from the environment into a list of rules.
funcsrc.jinja2.lexer.count_newlines(value:str) -> int
Count the number of newline characters in the string.
funcsrc.jinja2.lexer.describe_token(token:'Token') -> str
Returns a description of the token.
funcsrc.jinja2.lexer.describe_token_expr(expr:str) -> str
Like `describe_token` but for token expressions.
funcsrc.jinja2.lexer.get_lexer(environment:'Environment') -> 'Lexer'
Return a lexer which is probably cached.
classsrc.jinja2.loaders.BaseLoader
Baseclass for all loaders.
methodsrc.jinja2.loaders.BaseLoader.list_templates() -> list[str]
Iterates over all templates.
methodsrc.jinja2.loaders.BaseLoader.load(environment:'Environment', name:str, globals:t.MutableMapping[str, t.Any] | None=None) -> 'Template'
Loads a template.
classsrc.jinja2.loaders.FileSystemLoader
Load templates from a directory in the file system.
classsrc.jinja2.loaders.FunctionLoader
A loader that is passed a function which does the loading.
classsrc.jinja2.loaders.ModuleLoader
This loader loads templates from precompiled templates.
classsrc.jinja2.loaders.PackageLoader
Load templates from a directory in a Python package.
funcsrc.jinja2.loaders.split_template_path(template:str) -> list[str]
Split a path into segments and perform a sanity check.
classsrc.jinja2.meta.TrackingCodeGenerator
We abuse the code generator for introspection.
methodsrc.jinja2.meta.TrackingCodeGenerator.enter_frame(frame:Frame) -> None
Remember all undeclared identifiers.
methodsrc.jinja2.meta.TrackingCodeGenerator.write(x:str) -> None
Don't write.
funcsrc.jinja2.meta.find_referenced_templates(ast:nodes.Template) -> t.Iterator[str | None]
Finds all the referenced templates from the AST.
funcsrc.jinja2.nativetypes.native_concat(values:t.Iterable[t.Any]) -> t.Any | None
Return a native Python type from the list of compiled nodes.
classsrc.jinja2.nodes.Add
Add the left to the right node.
classsrc.jinja2.nodes.And
Short circuited AND.
classsrc.jinja2.nodes.Assign
Assigns an expression to a target.
classsrc.jinja2.nodes.AssignBlock
Assigns a block to a target.
classsrc.jinja2.nodes.BinExpr
Baseclass for all binary expressions.
classsrc.jinja2.nodes.Block
A node that represents a block.
classsrc.jinja2.nodes.Break
Break a loop.
classsrc.jinja2.nodes.Call
Calls an expression.
classsrc.jinja2.nodes.CallBlock
Like a macro without a name but a call instead.
classsrc.jinja2.nodes.Compare
Compares an expression with some other expressions.
classsrc.jinja2.nodes.CondExpr
A conditional expression (inline if expression).
classsrc.jinja2.nodes.Const
All constant values.
classsrc.jinja2.nodes.ContextReference
Returns the current template context.
classsrc.jinja2.nodes.Continue
Continue a loop.
classsrc.jinja2.nodes.DerivedContextReference
Return the current template context including locals.
classsrc.jinja2.nodes.Dict
Any dict literal such as ``{1: 2, 3: 4}``.
classsrc.jinja2.nodes.Div
Divides the left by the right node.
classsrc.jinja2.nodes.EnvironmentAttribute
Loads an attribute from the environment object.
classsrc.jinja2.nodes.EvalContext
Holds evaluation time information.
classsrc.jinja2.nodes.EvalContextModifier
Modifies the eval context.
classsrc.jinja2.nodes.Expr
Baseclass for all expressions.
methodsrc.jinja2.nodes.Expr.can_assign() -> bool
Check if it's possible to assign something to this node.
classsrc.jinja2.nodes.ExprStmt
A statement that evaluates an expression and discards the result.
classsrc.jinja2.nodes.Extends
Represents an extends statement.
classsrc.jinja2.nodes.ExtensionAttribute
Returns the attribute of an extension bound to the environment.
classsrc.jinja2.nodes.Filter
Apply a filter to an expression.
classsrc.jinja2.nodes.FilterBlock
Node for filter sections.
classsrc.jinja2.nodes.For
The for loop.
classsrc.jinja2.nodes.FromImport
A node that represents the from import tag.
classsrc.jinja2.nodes.Getitem
Get an attribute or item from an expression and prefer the item.
classsrc.jinja2.nodes.Helper
Nodes that exist in a specific context only.
classsrc.jinja2.nodes.If
If `test` is true, `body` is rendered, else `else_`.
classsrc.jinja2.nodes.Import
A node that represents the import tag.
classsrc.jinja2.nodes.Impossible
Raised if the node could not perform a requested action.
classsrc.jinja2.nodes.Include
A node that represents the include tag.
classsrc.jinja2.nodes.InternalName
An internal name in the compiler.
classsrc.jinja2.nodes.Keyword
A key, value pair for keyword arguments where key is a string.
classsrc.jinja2.nodes.List
Any list literal such as ``[1, 2, 3]``
classsrc.jinja2.nodes.Literal
Baseclass for literals.
classsrc.jinja2.nodes.Macro
A macro definition.
classsrc.jinja2.nodes.MarkSafe
Mark the wrapped expression as safe (wrap it as `Markup`).
classsrc.jinja2.nodes.Mod
Left modulo right.
classsrc.jinja2.nodes.Mul
Multiplies the left with the right node.
classsrc.jinja2.nodes.NSRef
Reference to a namespace value assignment
classsrc.jinja2.nodes.Name
Looks up a name or stores a value in a name.
classsrc.jinja2.nodes.Neg
Make the expression negative.
classsrc.jinja2.nodes.Node
Baseclass for all Jinja nodes.
methodsrc.jinja2.nodes.Node.find(node_type:type[_NodeBound]) -> _NodeBound | None
Find the first node of a given type.
methodsrc.jinja2.nodes.Node.find_all(node_type:type[_NodeBound] | tuple[type[_NodeBound], ...]) -> t.Iterator[_NodeBound]
Find all the nodes of a given type.
methodsrc.jinja2.nodes.Node.iter_child_nodes(exclude:t.Container[str] | None=None, only:t.Container[str] | None=None) -> t.Iterator['Node']
Iterates over all direct child nodes of the node.
methodsrc.jinja2.nodes.Node.set_ctx(ctx:str) -> 'Node'
Reset the context of a node and all child nodes.
methodsrc.jinja2.nodes.Node.set_environment(environment:'Environment') -> 'Node'
Set the environment for all nodes.
methodsrc.jinja2.nodes.Node.set_lineno(lineno:int, override:bool=False) -> 'Node'
Set the line numbers of the node and children.
classsrc.jinja2.nodes.Not
Negate the expression.
classsrc.jinja2.nodes.Operand
Holds an operator and an expression.
classsrc.jinja2.nodes.Or
Short circuited OR.
classsrc.jinja2.nodes.Output
A node that holds multiple expressions which are then printed out.
classsrc.jinja2.nodes.OverlayScope
An overlay scope for extensions.
classsrc.jinja2.nodes.Pair
A key, value pair for dicts.
classsrc.jinja2.nodes.Pos
Make the expression positive (noop for most expressions)
classsrc.jinja2.nodes.Pow
Left to the power of right.
classsrc.jinja2.nodes.Scope
An artificial scope.
classsrc.jinja2.nodes.ScopedEvalContextModifier
Modifies the eval context and reverts it later.
classsrc.jinja2.nodes.Slice
Represents a slice object.
classsrc.jinja2.nodes.Stmt
Base node for all statements.
classsrc.jinja2.nodes.Sub
Subtract the right from the left node.
classsrc.jinja2.nodes.Template
Node that represents a template.
classsrc.jinja2.nodes.TemplateData
A constant template string.
classsrc.jinja2.nodes.Test
Apply a test to an expression.
classsrc.jinja2.nodes.UnaryExpr
Baseclass for all unary expressions.
classsrc.jinja2.nodes.With
Specific node for with statements.
classsrc.jinja2.parser.Parser
This is the central parsing class Jinja uses.
methodsrc.jinja2.parser.Parser.fail_eof(end_tokens:tuple[str, ...] | None=None, lineno:int | None=None) -> 'te.NoReturn'
Like fail_unknown_tag but for end of template situations.
methodsrc.jinja2.parser.Parser.fail_unknown_tag(name:str, lineno:int | None=None) -> 'te.NoReturn'
Called if the parser encounters an unknown tag.
methodsrc.jinja2.parser.Parser.is_tuple_end(extra_end_rules:tuple[str, ...] | None=None) -> bool
Are we at the end of a tuple?
methodsrc.jinja2.parser.Parser.parse() -> nodes.Template
Parse the whole template into a `Template` node.
methodsrc.jinja2.parser.Parser.parse_expression(with_condexpr:bool=True) -> nodes.Expr
Parse an expression.
methodsrc.jinja2.parser.Parser.parse_for() -> nodes.For
Parse a for loop.
methodsrc.jinja2.parser.Parser.parse_if() -> nodes.If
Parse an if construct.
methodsrc.jinja2.parser.Parser.parse_primary(with_namespace:bool=False) -> nodes.Expr
Parse a name or literal value.
methodsrc.jinja2.parser.Parser.parse_set() -> nodes.Assign | nodes.AssignBlock
Parse an assign statement.
methodsrc.jinja2.parser.Parser.parse_statement() -> nodes.Node | list[nodes.Node]
Parse a single statement.
classsrc.jinja2.runtime.BlockReference
One block on a template reference.
methodsrc.jinja2.runtime.BlockReference.super() -> t.Union['BlockReference', 'Undefined']
Super the block.
classsrc.jinja2.runtime.Context
The template context holds the variables of a template.
methodsrc.jinja2.runtime.Context.derived(locals:dict[str, t.Any] | None=None) -> 'Context'
Internal helper function to create a derived context.
methodsrc.jinja2.runtime.Context.get_exported() -> dict[str, t.Any]
Get a new dict with the exported variables.
methodsrc.jinja2.runtime.Context.super(name:str, current:t.Callable[['Context'], t.Iterator[str]]) -> t.Union['BlockReference', 'Undefined']
Render a parent block.
classsrc.jinja2.runtime.DebugUndefined
An undefined that returns the debug info when printed.
methodsrc.jinja2.runtime.LoopContext.first() -> bool
Whether this is the first iteration of the loop.
methodsrc.jinja2.runtime.LoopContext.index() -> int
Current iteration of the loop, starting at 1.
methodsrc.jinja2.runtime.LoopContext.last() -> bool
Whether this is the last iteration of the loop.
methodsrc.jinja2.runtime.LoopContext.length() -> int
Length of the iterable.
methodsrc.jinja2.runtime.LoopContext.nextitem() -> t.Union[t.Any, 'Undefined']
The item in the next iteration.
methodsrc.jinja2.runtime.LoopContext.previtem() -> t.Union[t.Any, 'Undefined']
The item in the previous iteration.
methodsrc.jinja2.runtime.LoopContext.revindex() -> int
Number of iterations from the end of the loop, ending at 1.
methodsrc.jinja2.runtime.LoopContext.revindex0() -> int
Number of iterations from the end of the loop, ending at 0.
classsrc.jinja2.runtime.Macro
Wraps a macro function.
classsrc.jinja2.runtime.TemplateReference
The `self` in templates.
classsrc.jinja2.runtime.Undefined
The default undefined type.
funcsrc.jinja2.runtime.identity(x:V) -> V
Returns its argument.
funcsrc.jinja2.runtime.markup_join(seq:t.Iterable[t.Any]) -> str
Concatenation that escapes if necessary and converts to string.
funcsrc.jinja2.runtime.str_join(seq:t.Iterable[t.Any]) -> str
Simple args to string conversion and concatenation.
classsrc.jinja2.sandbox.SandboxedEnvironment
The sandboxed environment.
methodsrc.jinja2.sandbox.SandboxedEnvironment.call(__context:Context, __obj:t.Any, *args:t.Any, **kwargs:t.Any) -> t.Any
Call an object from sandboxed code.
methodsrc.jinja2.sandbox.SandboxedEnvironment.getattr(obj:t.Any, attribute:str) -> t.Any | Undefined
Subscribe an object from sandboxed code and prefer the attribute.
methodsrc.jinja2.sandbox.SandboxedEnvironment.getitem(obj:t.Any, argument:str | t.Any) -> t.Any | Undefined
Subscribe an object from sandboxed code.
methodsrc.jinja2.sandbox.SandboxedEnvironment.is_safe_callable(obj:t.Any) -> bool
Check if an object is safely callable.
methodsrc.jinja2.sandbox.SandboxedEnvironment.unsafe_undefined(obj:t.Any, attribute:str) -> Undefined
Return an undefined object for unsafe attributes.
funcsrc.jinja2.sandbox.is_internal_attribute(obj:t.Any, attr:str) -> bool
Test if the attribute given is an internal python attribute.
funcsrc.jinja2.sandbox.unsafe(f:F) -> F
Marks a function or method as unsafe.
methodsrc.jinja2.utils.Cycler.current() -> t.Any
Return the current item.
methodsrc.jinja2.utils.Cycler.next() -> t.Any
Return the current item, then advance :attr:`current` to the next item.
methodsrc.jinja2.utils.Cycler.reset() -> None
Resets the current item to the first item.
classsrc.jinja2.utils.Joiner
A joining helper for templates.
classsrc.jinja2.utils.LRUCache
A simple LRU Cache implementation.
methodsrc.jinja2.utils.LRUCache.clear() -> None
Clear the cache.
methodsrc.jinja2.utils.LRUCache.copy() -> 'te.Self'
Return a shallow copy of the instance.
methodsrc.jinja2.utils.LRUCache.get(key:t.Any, default:t.Any=None) -> t.Any
Return an item from the cache dict or `default`
methodsrc.jinja2.utils.LRUCache.items() -> t.Iterable[tuple[t.Any, t.Any]]
Return a list of items.
methodsrc.jinja2.utils.LRUCache.keys() -> t.Iterable[t.Any]
Return a list of all keys ordered by most recent usage.
methodsrc.jinja2.utils.LRUCache.values() -> t.Iterable[t.Any]
Return a list of all values.
classsrc.jinja2.utils.Namespace
A namespace object that can hold arbitrary attributes.
funcsrc.jinja2.utils.clear_caches() -> None
Jinja keeps internal caches for environments and lexers.
funcsrc.jinja2.utils.consume(iterable:t.Iterable[t.Any]) -> None
Consumes an iterable without doing anything with it.
funcsrc.jinja2.utils.generate_lorem_ipsum(n:int=5, html:bool=True, min:int=20, max:int=100) -> str
Generate some lorem ipsum for the template.
funcsrc.jinja2.utils.import_string(import_name:str, silent:bool=False) -> t.Any
Imports an object based on a string.
funcsrc.jinja2.utils.internalcode(f:F) -> F
Marks the function as internally used
funcsrc.jinja2.utils.is_undefined(obj:t.Any) -> bool
Check if the object passed is undefined.
funcsrc.jinja2.utils.object_type_repr(obj:t.Any) -> str
Returns the name of the object's type.
funcsrc.jinja2.utils.pformat(obj:t.Any) -> str
Format an object using :func:`pprint.pformat`.
funcsrc.jinja2.utils.url_quote(obj:t.Any, charset:str='utf-8', for_qs:bool=False) -> str
Quote a string for use in a URL using the given charset.
funcsrc.jinja2.utils.urlize(text:str, trim_url_limit:int | None=None, rel:str | None=None, target:str | None=None, extra_schemes:t.Iterable[str] | None=None) -> str
Convert URLs in text into clickable links.
methodsrc.jinja2.visitor.NodeVisitor.generic_visit(node:Node, *args:t.Any, **kwargs:t.Any) -> t.Any
Called if no explicit visitor function exists for a node.
methodsrc.jinja2.visitor.NodeVisitor.visit(node:Node, *args:t.Any, **kwargs:t.Any) -> t.Any
Visit a node.

About this data

These signatures were extracted from the public source of pallets/jinja using Python's ast module. Argument names, default values, type annotations and return types are taken verbatim from the code. Implementation bodies are never stored. See how it works for details.

Back to all 805 libraries