class documentation

The core component of Jinja is the `Environment`. It contains important shared variables like configuration, filters, tests, globals and others. Instances of this class may be modified if they are not shared and if no template was loaded so far. Modifications on environments after the first template was loaded will lead to surprising effects and undefined behavior. Here are the possible initialization parameters: `block_start_string` The string marking the beginning of a block. Defaults to ``'{%'``. `block_end_string` The string marking the end of a block. Defaults to ``'%}'``. `variable_start_string` The string marking the beginning of a print statement. Defaults to ``'{{'``. `variable_end_string` The string marking the end of a print statement. Defaults to ``'}}'``. `comment_start_string` The string marking the beginning of a comment. Defaults to ``'{#'``. `comment_end_string` The string marking the end of a comment. Defaults to ``'#}'``. `line_statement_prefix` If given and a string, this will be used as prefix for line based statements. See also :ref:`line-statements`. `line_comment_prefix` If given and a string, this will be used as prefix for line based comments. See also :ref:`line-statements`. .. versionadded:: 2.2 `trim_blocks` If this is set to ``True`` the first newline after a block is removed (block, not variable tag!). Defaults to `False`. `lstrip_blocks` If this is set to ``True`` leading spaces and tabs are stripped from the start of a line to a block. Defaults to `False`. `newline_sequence` The sequence that starts a newline. Must be one of ``'\r'``, ``'\n'`` or ``'\r\n'``. The default is ``'\n'`` which is a useful default for Linux and OS X systems as well as web applications. `keep_trailing_newline` Preserve the trailing newline when rendering templates. The default is ``False``, which causes a single newline, if present, to be stripped from the end of the template. .. versionadded:: 2.7 `extensions` List of Jinja extensions to use. This can either be import paths as strings or extension classes. For more information have a look at :ref:`the extensions documentation <jinja-extensions>`. `optimized` should the optimizer be enabled? Default is ``True``. `undefined` :class:`Undefined` or a subclass of it that is used to represent undefined values in the template. `finalize` A callable that can be used to process the result of a variable expression before it is output. For example one can convert ``None`` implicitly into an empty string here. `autoescape` If set to ``True`` the XML/HTML autoescaping feature is enabled by default. For more details about autoescaping see :class:`~markupsafe.Markup`. As of Jinja 2.4 this can also be a callable that is passed the template name and has to return ``True`` or ``False`` depending on autoescape should be enabled by default. .. versionchanged:: 2.4 `autoescape` can now be a function `loader` The template loader for this environment. `cache_size` The size of the cache. Per default this is ``400`` which means that if more than 400 templates are loaded the loader will clean out the least recently used template. If the cache size is set to ``0`` templates are recompiled all the time, if the cache size is ``-1`` the cache will not be cleaned. .. versionchanged:: 2.8 The cache size was increased to 400 from a low 50. `auto_reload` Some loaders load templates from locations where the template sources may change (ie: file system or database). If ``auto_reload`` is set to ``True`` (default) every time a template is requested the loader checks if the source changed and if yes, it will reload the template. For higher performance it's possible to disable that. `bytecode_cache` If set to a bytecode cache object, this object will provide a cache for the internal Jinja bytecode so that templates don't have to be parsed if they were not changed. See :ref:`bytecode-cache` for more information. `enable_async` If set to true this enables async template execution which allows using async functions and generators.

Method __init__ Undocumented
Method add_extension Adds an extension after the environment was created.
Method call_filter Invoke a filter on a value the same way the compiler does.
Method call_test Invoke a test on a value the same way the compiler does.
Method compile Compile a node or template source code. The `name` parameter is the load name of the template after it was joined using :meth:`join_path` if necessary, not the filename on the file system. the `filename` parameter is the estimated filename of the template on the file system...
Method compile_expression A handy helper method that returns a callable that accepts keyword arguments that appear as variables in the expression. If called it returns the result of the expression.
Method compile_templates Finds all the templates the loader can find, compiles them and stores them in `target`. If `zip` is `None`, instead of in a zipfile, the templates will be stored in a directory. By default a deflate zip algorithm is used...
Method extend Add the items to the instance of the environment if they do not exist yet. This is used by :ref:`extensions <writing-extensions>` to register callbacks and configuration values without breaking inheritance.
Method from_string Load a template from a source string without using :attr:`loader`.
Method get_or_select_template Use :meth:`select_template` if an iterable of template names is given, or :meth:`get_template` if one name is given.
Method get_template Load a template by name with :attr:`loader` and return a :class:`Template`. If the template does not exist a :exc:`TemplateNotFound` exception is raised.
Method getattr Get an item or attribute of an object but prefer the attribute. Unlike :meth:`getitem` the attribute *must* be a string.
Method getitem Get an item or attribute of an object but prefer the item.
Method handle_exception Exception handling helper. This is used internally to either raise rewritten exceptions or return a rendered traceback for the template.
Method iter_extensions Iterates over the extensions by priority.
Method join_path Join a template with the parent. By default all the lookups are relative to the loader root so this method returns the `template` parameter unchanged, but if the paths should be relative to the parent template, this function can be used to calculate the real template name.
Method lex Lex the given sourcecode and return a generator that yields tokens as tuples in the form ``(lineno, token_type, value)``. This can be useful for :ref:`extension development <writing-extensions>` and debugging templates.
Method list_templates Returns a list of templates for this environment. This requires that the loader supports the loader's :meth:`~BaseLoader.list_templates` method.
Method make_globals Make the globals map for a template. Any given template globals overlay the environment :attr:`globals`.
Method overlay Create a new overlay environment that shares all the data with the current environment except for cache and the overridden attributes. Extensions cannot be removed for an overlayed environment. An overlayed environment automatically gets all the extensions of the environment it is linked to plus optional extra extensions.
Method parse Parse the sourcecode and return the abstract syntax tree. This tree of nodes is used by the compiler to convert the template into executable source- or bytecode. This is useful for debugging or to extract information from templates.
Method preprocess Preprocesses the source with all extensions. This is automatically called for all parsing and compiling methods but *not* for :meth:`lex` because there you usually only want the actual source tokenized.
Method select_template Like :meth:`get_template`, but tries loading multiple names. If none of the names can be loaded a :exc:`TemplatesNotFound` exception is raised.
Class Variable concat Undocumented
Class Variable linked_to Undocumented
Class Variable overlayed Undocumented
Class Variable sandboxed Undocumented
Class Variable shared Undocumented
Class Variable template_class Undocumented
Instance Variable auto_reload Undocumented
Instance Variable autoescape Undocumented
Instance Variable block_end_string Undocumented
Instance Variable block_start_string Undocumented
Instance Variable bytecode_cache Undocumented
Instance Variable cache Undocumented
Instance Variable comment_end_string Undocumented
Instance Variable comment_start_string Undocumented
Instance Variable extensions Undocumented
Instance Variable filters Undocumented
Instance Variable finalize Undocumented
Instance Variable globals Undocumented
Instance Variable is_async Undocumented
Instance Variable keep_trailing_newline Undocumented
Instance Variable line_comment_prefix Undocumented
Instance Variable line_statement_prefix Undocumented
Instance Variable loader Undocumented
Instance Variable lstrip_blocks Undocumented
Instance Variable newline_sequence Undocumented
Instance Variable optimized Undocumented
Instance Variable policies Undocumented
Instance Variable tests Undocumented
Instance Variable trim_blocks Undocumented
Instance Variable undefined Undocumented
Instance Variable variable_end_string Undocumented
Instance Variable variable_start_string Undocumented
Property lexer The lexer for this environment.
Method _compile Internal hook that can be overridden to hook a different compile method in.
Method _filter_test_common Undocumented
Method _generate Internal hook that can be overridden to hook a different generate method in.
Method _load_template Undocumented
Method _parse Internal parsing function used by `parse` and `compile`.
Method _tokenize Called by the parser to do the preprocessing and filtering for all the extensions. Returns a :class:`~jinja2.lexer.TokenStream`.
def __init__(self, block_start_string=BLOCK_START_STRING, block_end_string=BLOCK_END_STRING, variable_start_string=VARIABLE_START_STRING, variable_end_string=VARIABLE_END_STRING, comment_start_string=COMMENT_START_STRING, comment_end_string=COMMENT_END_STRING, line_statement_prefix=LINE_STATEMENT_PREFIX, line_comment_prefix=LINE_COMMENT_PREFIX, trim_blocks=TRIM_BLOCKS, lstrip_blocks=LSTRIP_BLOCKS, newline_sequence=NEWLINE_SEQUENCE, keep_trailing_newline=KEEP_TRAILING_NEWLINE, extensions=(), optimized=True, undefined=Undefined, finalize=None, autoescape=False, loader=None, cache_size=400, auto_reload=True, bytecode_cache=None, enable_async=False): (source)

Undocumented

Parameters
block_start_string:strUndocumented
block_end_string:strUndocumented
variable_start_string:strUndocumented
variable_end_string:strUndocumented
comment_start_string:strUndocumented
comment_end_string:strUndocumented
line_statement_prefix:t.Optional[str]Undocumented
line_comment_prefix:t.Optional[str]Undocumented
trim_blocks:boolUndocumented
lstrip_blocks:boolUndocumented
newline_sequence:te.Literal['\n', '\r\n', '\r']Undocumented
keep_trailing_newline:boolUndocumented
extensions:t.Sequence[t.Union[str, t.Type[Extension]]]Undocumented
optimized:boolUndocumented
undefined:t.Type[Undefined]Undocumented
finalize:t.Optional[t.Callable[..., t.Any]]Undocumented
autoescape:t.Union[bool, t.Callable[[t.Optional[str]], bool]]Undocumented
loader:t.Optional[BaseLoader]Undocumented
cache_size:intUndocumented
auto_reload:boolUndocumented
bytecode_cache:t.Optional[BytecodeCache]Undocumented
enable_async:boolUndocumented
def add_extension(self, extension): (source)

Adds an extension after the environment was created. .. versionadded:: 2.5

Parameters
extension:t.Union[str, t.Type[Extension]]Undocumented
def call_filter(self, name, value, args=None, kwargs=None, context=None, eval_ctx=None): (source)

Invoke a filter on a value the same way the compiler does. This might return a coroutine if the filter is running from an environment in async mode and the filter supports async execution. It's your responsibility to await this if needed. .. versionadded:: 2.7

Parameters
name:strUndocumented
value:t.AnyUndocumented
args:t.Optional[t.Sequence[t.Any]]Undocumented
kwargs:t.Optional[t.Mapping[str, t.Any]]Undocumented
context:t.Optional[Context]Undocumented
eval_ctx:t.Optional[EvalContext]Undocumented
Returns
t.AnyUndocumented
def call_test(self, name, value, args=None, kwargs=None, context=None, eval_ctx=None): (source)

Invoke a test on a value the same way the compiler does. This might return a coroutine if the test is running from an environment in async mode and the test supports async execution. It's your responsibility to await this if needed. .. versionchanged:: 3.0 Tests support ``@pass_context``, etc. decorators. Added the ``context`` and ``eval_ctx`` parameters. .. versionadded:: 2.7

Parameters
name:strUndocumented
value:t.AnyUndocumented
args:t.Optional[t.Sequence[t.Any]]Undocumented
kwargs:t.Optional[t.Mapping[str, t.Any]]Undocumented
context:t.Optional[Context]Undocumented
eval_ctx:t.Optional[EvalContext]Undocumented
Returns
t.AnyUndocumented
@internalcode
def compile(self, source, name=None, filename=None, raw=False, defer_init=False): (source)

Compile a node or template source code. The `name` parameter is the load name of the template after it was joined using :meth:`join_path` if necessary, not the filename on the file system. the `filename` parameter is the estimated filename of the template on the file system. If the template came from a database or memory this can be omitted. The return value of this method is a python code object. If the `raw` parameter is `True` the return value will be a string with python code equivalent to the bytecode returned otherwise. This method is mainly used internally. `defer_init` is use internally to aid the module code generator. This causes the generated code to be able to import without the global environment variable to be set. .. versionadded:: 2.4 `defer_init` parameter added.

Parameters
source:t.Union[str, nodes.Template]Undocumented
name:t.Optional[str]Undocumented
filename:t.Optional[str]Undocumented
raw:boolUndocumented
defer_init:boolUndocumented
Returns
t.Union[str, CodeType]Undocumented
def compile_expression(self, source, undefined_to_none=True): (source)

A handy helper method that returns a callable that accepts keyword arguments that appear as variables in the expression. If called it returns the result of the expression. This is useful if applications want to use the same rules as Jinja in template "configuration files" or similar situations. Example usage: >>> env = Environment() >>> expr = env.compile_expression('foo == 42') >>> expr(foo=23) False >>> expr(foo=42) True Per default the return value is converted to `None` if the expression returns an undefined value. This can be changed by setting `undefined_to_none` to `False`. >>> env.compile_expression('var')() is None True >>> env.compile_expression('var', undefined_to_none=False)() Undefined .. versionadded:: 2.1

Parameters
source:strUndocumented
undefined_to_none:boolUndocumented
Returns
TemplateExpressionUndocumented
def compile_templates(self, target, extensions=None, filter_func=None, zip='deflated', log_function=None, ignore_errors=True): (source)

Finds all the templates the loader can find, compiles them and stores them in `target`. If `zip` is `None`, instead of in a zipfile, the templates will be stored in a directory. By default a deflate zip algorithm is used. To switch to the stored algorithm, `zip` can be set to ``'stored'``. `extensions` and `filter_func` are passed to :meth:`list_templates`. Each template returned will be compiled to the target folder or zipfile. By default template compilation errors are ignored. In case a log function is provided, errors are logged. If you want template syntax errors to abort the compilation you can set `ignore_errors` to `False` and you will get an exception on syntax errors. .. versionadded:: 2.4

Parameters
target:t.Union[str, os.PathLike]Undocumented
extensions:t.Optional[t.Collection[str]]Undocumented
filter_func:t.Optional[t.Callable[[str], bool]]Undocumented
zip:t.Optional[str]Undocumented
log_function:t.Optional[t.Callable[[str], None]]Undocumented
ignore_errors:boolUndocumented
def extend(self, **attributes): (source)

Add the items to the instance of the environment if they do not exist yet. This is used by :ref:`extensions <writing-extensions>` to register callbacks and configuration values without breaking inheritance.

Parameters
**attributes:t.AnyUndocumented
def from_string(self, source, globals=None, template_class=None): (source)

Load a template from a source string without using :attr:`loader`. :param source: Jinja source to compile into a template. :param globals: Extend the environment :attr:`globals` with these extra variables available for all renders of this template. If the template has already been loaded and cached, its globals are updated with any new items. :param template_class: Return an instance of this :class:`Template` class.

Parameters
source:t.Union[str, nodes.Template]Undocumented
globals:t.Optional[t.MutableMapping[str, t.Any]]Undocumented
template_class:t.Optional[t.Type[Template]]Undocumented
Returns
TemplateUndocumented
@internalcode
def get_or_select_template(self, template_name_or_list, parent=None, globals=None): (source)

Use :meth:`select_template` if an iterable of template names is given, or :meth:`get_template` if one name is given. .. versionadded:: 2.3

Parameters
template_name_or_list:t.Union[str, Template, t.List[t.Union[str, Template]]]Undocumented
parent:t.Optional[str]Undocumented
globals:t.Optional[t.MutableMapping[str, t.Any]]Undocumented
Returns
TemplateUndocumented
@internalcode
def get_template(self, name, parent=None, globals=None): (source)

Load a template by name with :attr:`loader` and return a :class:`Template`. If the template does not exist a :exc:`TemplateNotFound` exception is raised. :param name: Name of the template to load. When loading templates from the filesystem, "/" is used as the path separator, even on Windows. :param parent: The name of the parent template importing this template. :meth:`join_path` can be used to implement name transformations with this. :param globals: Extend the environment :attr:`globals` with these extra variables available for all renders of this template. If the template has already been loaded and cached, its globals are updated with any new items. .. versionchanged:: 3.0 If a template is loaded from cache, ``globals`` will update the template's globals instead of ignoring the new values. .. versionchanged:: 2.4 If ``name`` is a :class:`Template` object it is returned unchanged.

Parameters
name:t.Union[str, Template]Undocumented
parent:t.Optional[str]Undocumented
globals:t.Optional[t.MutableMapping[str, t.Any]]Undocumented
Returns
TemplateUndocumented
def getattr(self, obj, attribute): (source)

Get an item or attribute of an object but prefer the attribute. Unlike :meth:`getitem` the attribute *must* be a string.

Parameters
obj:t.AnyUndocumented
attribute:strUndocumented
Returns
t.AnyUndocumented
def getitem(self, obj, argument): (source)

Get an item or attribute of an object but prefer the item.

Parameters
obj:t.AnyUndocumented
argument:t.Union[str, t.Any]Undocumented
Returns
t.Union[t.Any, Undefined]Undocumented
def handle_exception(self, source=None): (source)

Exception handling helper. This is used internally to either raise rewritten exceptions or return a rendered traceback for the template.

Parameters
source:t.Optional[str]Undocumented
Returns
te.NoReturnUndocumented
def iter_extensions(self): (source)

Iterates over the extensions by priority.

Returns
t.Iterator[Extension]Undocumented
def join_path(self, template, parent): (source)

Join a template with the parent. By default all the lookups are relative to the loader root so this method returns the `template` parameter unchanged, but if the paths should be relative to the parent template, this function can be used to calculate the real template name. Subclasses may override this method and implement template path joining here.

Parameters
template:strUndocumented
parent:strUndocumented
Returns
strUndocumented
def lex(self, source, name=None, filename=None): (source)

Lex the given sourcecode and return a generator that yields tokens as tuples in the form ``(lineno, token_type, value)``. This can be useful for :ref:`extension development <writing-extensions>` and debugging templates. This does not perform preprocessing. If you want the preprocessing of the extensions to be applied you have to filter source through the :meth:`preprocess` method.

Parameters
source:strUndocumented
name:t.Optional[str]Undocumented
filename:t.Optional[str]Undocumented
Returns
t.Iterator[t.Tuple[int, str, str]]Undocumented
def list_templates(self, extensions=None, filter_func=None): (source)

Returns a list of templates for this environment. This requires that the loader supports the loader's :meth:`~BaseLoader.list_templates` method. If there are other files in the template folder besides the actual templates, the returned list can be filtered. There are two ways: either `extensions` is set to a list of file extensions for templates, or a `filter_func` can be provided which is a callable that is passed a template name and should return `True` if it should end up in the result list. If the loader does not support that, a :exc:`TypeError` is raised. .. versionadded:: 2.4

Parameters
extensions:t.Optional[t.Collection[str]]Undocumented
filter_func:t.Optional[t.Callable[[str], bool]]Undocumented
Returns
t.List[str]Undocumented
def make_globals(self, d): (source)

Make the globals map for a template. Any given template globals overlay the environment :attr:`globals`. Returns a :class:`collections.ChainMap`. This allows any changes to a template's globals to only affect that template, while changes to the environment's globals are still reflected. However, avoid modifying any globals after a template is loaded. :param d: Dict of template-specific globals. .. versionchanged:: 3.0 Use :class:`collections.ChainMap` to always prevent mutating environment globals.

Parameters
d:t.Optional[t.MutableMapping[str, t.Any]]Undocumented
Returns
t.MutableMapping[str, t.Any]Undocumented
def overlay(self, block_start_string=missing, block_end_string=missing, variable_start_string=missing, variable_end_string=missing, comment_start_string=missing, comment_end_string=missing, line_statement_prefix=missing, line_comment_prefix=missing, trim_blocks=missing, lstrip_blocks=missing, newline_sequence=missing, keep_trailing_newline=missing, extensions=missing, optimized=missing, undefined=missing, finalize=missing, autoescape=missing, loader=missing, cache_size=missing, auto_reload=missing, bytecode_cache=missing, enable_async=False): (source)

Create a new overlay environment that shares all the data with the current environment except for cache and the overridden attributes. Extensions cannot be removed for an overlayed environment. An overlayed environment automatically gets all the extensions of the environment it is linked to plus optional extra extensions. Creating overlays should happen after the initial environment was set up completely. Not all attributes are truly linked, some are just copied over so modifications on the original environment may not shine through. .. versionchanged:: 3.1.2 Added the ``newline_sequence``,, ``keep_trailing_newline``, and ``enable_async`` parameters to match ``__init__``.

Parameters
block_start_string:strUndocumented
block_end_string:strUndocumented
variable_start_string:strUndocumented
variable_end_string:strUndocumented
comment_start_string:strUndocumented
comment_end_string:strUndocumented
line_statement_prefix:t.Optional[str]Undocumented
line_comment_prefix:t.Optional[str]Undocumented
trim_blocks:boolUndocumented
lstrip_blocks:boolUndocumented
newline_sequence:te.Literal['\n', '\r\n', '\r']Undocumented
keep_trailing_newline:boolUndocumented
extensions:t.Sequence[t.Union[str, t.Type[Extension]]]Undocumented
optimized:boolUndocumented
undefined:t.Type[Undefined]Undocumented
finalize:t.Optional[t.Callable[..., t.Any]]Undocumented
autoescape:t.Union[bool, t.Callable[[t.Optional[str]], bool]]Undocumented
loader:t.Optional[BaseLoader]Undocumented
cache_size:intUndocumented
auto_reload:boolUndocumented
bytecode_cache:t.Optional[BytecodeCache]Undocumented
enable_async:boolUndocumented
Returns
EnvironmentUndocumented
@internalcode
def parse(self, source, name=None, filename=None): (source)

Parse the sourcecode and return the abstract syntax tree. This tree of nodes is used by the compiler to convert the template into executable source- or bytecode. This is useful for debugging or to extract information from templates. If you are :ref:`developing Jinja extensions <writing-extensions>` this gives you a good overview of the node tree generated.

Parameters
source:strUndocumented
name:t.Optional[str]Undocumented
filename:t.Optional[str]Undocumented
Returns
nodes.TemplateUndocumented
def preprocess(self, source, name=None, filename=None): (source)

Preprocesses the source with all extensions. This is automatically called for all parsing and compiling methods but *not* for :meth:`lex` because there you usually only want the actual source tokenized.

Parameters
source:strUndocumented
name:t.Optional[str]Undocumented
filename:t.Optional[str]Undocumented
Returns
strUndocumented
@internalcode
def select_template(self, names, parent=None, globals=None): (source)

Like :meth:`get_template`, but tries loading multiple names. If none of the names can be loaded a :exc:`TemplatesNotFound` exception is raised. :param names: List of template names to try loading in order. :param parent: The name of the parent template importing this template. :meth:`join_path` can be used to implement name transformations with this. :param globals: Extend the environment :attr:`globals` with these extra variables available for all renders of this template. If the template has already been loaded and cached, its globals are updated with any new items. .. versionchanged:: 3.0 If a template is loaded from cache, ``globals`` will update the template's globals instead of ignoring the new values. .. versionchanged:: 2.11 If ``names`` is :class:`Undefined`, an :exc:`UndefinedError` is raised instead. If no templates were found and ``names`` contains :class:`Undefined`, the message is more helpful. .. versionchanged:: 2.4 If ``names`` contains a :class:`Template` object it is returned unchanged. .. versionadded:: 2.3

Parameters
names:t.Iterable[t.Union[str, Template]]Undocumented
parent:t.Optional[str]Undocumented
globals:t.Optional[t.MutableMapping[str, t.Any]]Undocumented
Returns
TemplateUndocumented
concat = (source)

Undocumented

Undocumented

overlayed: bool = (source)

Undocumented

sandboxed: bool = (source)

Undocumented

shared: bool = (source)

Undocumented

template_class: t.Type[Template] = (source)

Undocumented

auto_reload = (source)

Undocumented

autoescape = (source)

Undocumented

block_end_string = (source)

Undocumented

block_start_string = (source)

Undocumented

bytecode_cache = (source)

Undocumented

cache = (source)

Undocumented

comment_end_string = (source)

Undocumented

comment_start_string = (source)

Undocumented

extensions = (source)

Undocumented

filters = (source)

Undocumented

finalize = (source)

Undocumented

globals = (source)

Undocumented

is_async = (source)

Undocumented

keep_trailing_newline = (source)

Undocumented

line_comment_prefix = (source)

Undocumented

line_statement_prefix = (source)

Undocumented

loader = (source)

Undocumented

lstrip_blocks = (source)

Undocumented

newline_sequence = (source)

Undocumented

optimized = (source)

Undocumented

policies = (source)

Undocumented

tests = (source)

Undocumented

trim_blocks = (source)

Undocumented

Undocumented

variable_end_string = (source)

Undocumented

variable_start_string = (source)

Undocumented

The lexer for this environment.

def _compile(self, source, filename): (source)

Internal hook that can be overridden to hook a different compile method in. .. versionadded:: 2.5

Parameters
source:strUndocumented
filename:strUndocumented
Returns
CodeTypeUndocumented
def _filter_test_common(self, name, value, args, kwargs, context, eval_ctx, is_filter): (source)

Undocumented

Parameters
name:t.Union[str, Undefined]Undocumented
value:t.AnyUndocumented
args:t.Optional[t.Sequence[t.Any]]Undocumented
kwargs:t.Optional[t.Mapping[str, t.Any]]Undocumented
context:t.Optional[Context]Undocumented
eval_ctx:t.Optional[EvalContext]Undocumented
is_filter:boolUndocumented
Returns
t.AnyUndocumented
def _generate(self, source, name, filename, defer_init=False): (source)

Internal hook that can be overridden to hook a different generate method in. .. versionadded:: 2.5

Parameters
source:nodes.TemplateUndocumented
name:t.Optional[str]Undocumented
filename:t.Optional[str]Undocumented
defer_init:boolUndocumented
Returns
strUndocumented
@internalcode
def _load_template(self, name, globals): (source)

Undocumented

Parameters
name:strUndocumented
globals:t.Optional[t.MutableMapping[str, t.Any]]Undocumented
Returns
TemplateUndocumented
def _parse(self, source, name, filename): (source)

Internal parsing function used by `parse` and `compile`.

Parameters
source:strUndocumented
name:t.Optional[str]Undocumented
filename:t.Optional[str]Undocumented
Returns
nodes.TemplateUndocumented
def _tokenize(self, source, name, filename=None, state=None): (source)

Called by the parser to do the preprocessing and filtering for all the extensions. Returns a :class:`~jinja2.lexer.TokenStream`.

Parameters
source:strUndocumented
name:t.Optional[str]Undocumented
filename:t.Optional[str]Undocumented
state:t.Optional[str]Undocumented
Returns
TokenStreamUndocumented