Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | List of all members
jinja2.environment.Environment Class Reference
Inheritance diagram for jinja2.environment.Environment:
Inheritance graph
[legend]
Collaboration diagram for jinja2.environment.Environment:
Collaboration graph
[legend]

Public Member Functions

 __init__ (self, str block_start_string=BLOCK_START_STRING, str block_end_string=BLOCK_END_STRING, str variable_start_string=VARIABLE_START_STRING, str variable_end_string=VARIABLE_END_STRING, str comment_start_string=COMMENT_START_STRING, str comment_end_string=COMMENT_END_STRING, t.Optional[str] line_statement_prefix=LINE_STATEMENT_PREFIX, t.Optional[str] line_comment_prefix=LINE_COMMENT_PREFIX, bool trim_blocks=TRIM_BLOCKS, bool lstrip_blocks=LSTRIP_BLOCKS, "te.Literal['\\n', '\\r\\n', '\\r']" newline_sequence=NEWLINE_SEQUENCE, bool keep_trailing_newline=KEEP_TRAILING_NEWLINE, t.Sequence[t.Union[str, t.Type["Extension"]]] extensions=(), bool optimized=True, t.Type[Undefined] undefined=Undefined, t.Optional[t.Callable[..., t.Any]] finalize=None, t.Union[bool, t.Callable[[t.Optional[str]], bool]] autoescape=False, t.Optional["BaseLoader"] loader=None, int cache_size=400, bool auto_reload=True, t.Optional["BytecodeCache"] bytecode_cache=None, bool enable_async=False)
 
None add_extension (self, t.Union[str, t.Type["Extension"]] extension)
 
None extend (self, **t.Any attributes)
 
"te.Self" overlay (self, str block_start_string=missing, str block_end_string=missing, str variable_start_string=missing, str variable_end_string=missing, str comment_start_string=missing, str comment_end_string=missing, t.Optional[str] line_statement_prefix=missing, t.Optional[str] line_comment_prefix=missing, bool trim_blocks=missing, bool lstrip_blocks=missing, "te.Literal['\\n', '\\r\\n', '\\r']" newline_sequence=missing, bool keep_trailing_newline=missing, t.Sequence[t.Union[str, t.Type["Extension"]]] extensions=missing, bool optimized=missing, t.Type[Undefined] undefined=missing, t.Optional[t.Callable[..., t.Any]] finalize=missing, t.Union[bool, t.Callable[[t.Optional[str]], bool]] autoescape=missing, t.Optional["BaseLoader"] loader=missing, int cache_size=missing, bool auto_reload=missing, t.Optional["BytecodeCache"] bytecode_cache=missing, bool enable_async=missing)
 
Lexer lexer (self)
 
t.Iterator["Extension"] iter_extensions (self)
 
t.Union[t.Any, Undefinedgetitem (self, t.Any obj, t.Union[str, t.Any] argument)
 
t.Any getattr (self, t.Any obj, str attribute)
 
t.Any call_filter (self, str name, t.Any value, t.Optional[t.Sequence[t.Any]] args=None, t.Optional[t.Mapping[str, t.Any]] kwargs=None, t.Optional[Context] context=None, t.Optional[EvalContext] eval_ctx=None)
 
t.Any call_test (self, str name, t.Any value, t.Optional[t.Sequence[t.Any]] args=None, t.Optional[t.Mapping[str, t.Any]] kwargs=None, t.Optional[Context] context=None, t.Optional[EvalContext] eval_ctx=None)
 
nodes.Template parse (self, str source, t.Optional[str] name=None, t.Optional[str] filename=None)
 
t.Iterator[t.Tuple[int, str, str]] lex (self, str source, t.Optional[str] name=None, t.Optional[str] filename=None)
 
str preprocess (self, str source, t.Optional[str] name=None, t.Optional[str] filename=None)
 
CodeType compile (self, t.Union[str, nodes.Template] source, t.Optional[str] name=None, t.Optional[str] filename=None, "te.Literal[False]" raw=False, bool defer_init=False)
 
str compile (self, t.Union[str, nodes.Template] source, t.Optional[str] name=None, t.Optional[str] filename=None, "te.Literal[True]" raw=..., bool defer_init=False)
 
t.Union[str, CodeType] compile (self, t.Union[str, nodes.Template] source, t.Optional[str] name=None, t.Optional[str] filename=None, bool raw=False, bool defer_init=False)
 
"TemplateExpression" compile_expression (self, str source, bool undefined_to_none=True)
 
None compile_templates (self, t.Union[str, "os.PathLike[str]"] target, t.Optional[t.Collection[str]] extensions=None, t.Optional[t.Callable[[str], bool]] filter_func=None, t.Optional[str] zip="deflated", t.Optional[t.Callable[[str], None]] log_function=None, bool ignore_errors=True)
 
t.List[str] list_templates (self, t.Optional[t.Collection[str]] extensions=None, t.Optional[t.Callable[[str], bool]] filter_func=None)
 
"te.NoReturn" handle_exception (self, t.Optional[str] source=None)
 
str join_path (self, str template, str parent)
 
"Template" get_template (self, t.Union[str, "Template"] name, t.Optional[str] parent=None, t.Optional[t.MutableMapping[str, t.Any]] globals=None)
 
"Template" select_template (self, t.Iterable[t.Union[str, "Template"]] names, t.Optional[str] parent=None, t.Optional[t.MutableMapping[str, t.Any]] globals=None)
 
"Template" get_or_select_template (self, t.Union[str, "Template", t.List[t.Union[str, "Template"]]] template_name_or_list, t.Optional[str] parent=None, t.Optional[t.MutableMapping[str, t.Any]] globals=None)
 
"Template" from_string (self, t.Union[str, nodes.Template] source, t.Optional[t.MutableMapping[str, t.Any]] globals=None, t.Optional[t.Type["Template"]] template_class=None)
 
t.MutableMapping[str, t.Any] make_globals (self, t.Optional[t.MutableMapping[str, t.Any]] d)
 

Public Attributes

 block_start_string
 
 block_end_string
 
 variable_start_string
 
 variable_end_string
 
 comment_start_string
 
 comment_end_string
 
 line_statement_prefix
 
 line_comment_prefix
 
 trim_blocks
 
 lstrip_blocks
 
 newline_sequence
 
 keep_trailing_newline
 
 optimized
 
 finalize
 
 autoescape
 
 filters
 
 tests
 
 globals
 
 loader
 
 cache
 
 bytecode_cache
 
 auto_reload
 
 policies
 
 extensions
 
 is_async
 

Static Public Attributes

bool sandboxed = False
 
bool overlayed = False
 
linked_to = None
 
bool shared = False
 
code_generator_class = CodeGenerator
 
str concat = "".join
 
context_class = Context
 
template_class .Type["Template"]
 

Protected Member Functions

t.Any _filter_test_common (self, t.Union[str, Undefined] name, t.Any value, t.Optional[t.Sequence[t.Any]] args, t.Optional[t.Mapping[str, t.Any]] kwargs, t.Optional[Context] context, t.Optional[EvalContext] eval_ctx, bool is_filter)
 
nodes.Template _parse (self, str source, t.Optional[str] name, t.Optional[str] filename)
 
TokenStream _tokenize (self, str source, t.Optional[str] name, t.Optional[str] filename=None, t.Optional[str] state=None)
 
str _generate (self, nodes.Template source, t.Optional[str] name, t.Optional[str] filename, bool defer_init=False)
 
CodeType _compile (self, str source, str filename)
 
"Template" _load_template (self, str name, t.Optional[t.MutableMapping[str, t.Any]] globals)
 

Detailed Description

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.

Member Function Documentation

◆ _compile()

CodeType jinja2.environment.Environment._compile (   self,
str  source,
str  filename 
)
protected
Internal hook that can be overridden to hook a different compile
method in.

.. versionadded:: 2.5

◆ _generate()

str jinja2.environment.Environment._generate (   self,
nodes.Template  source,
t.Optional[str]  name,
t.Optional[str]  filename,
bool   defer_init = False 
)
protected
Internal hook that can be overridden to hook a different generate
method in.

.. versionadded:: 2.5

◆ _parse()

nodes.Template jinja2.environment.Environment._parse (   self,
str  source,
t.Optional[str]  name,
t.Optional[str]   filename 
)
protected
Internal parsing function used by `parse` and `compile`.

◆ _tokenize()

TokenStream jinja2.environment.Environment._tokenize (   self,
str  source,
t.Optional[str]  name,
t.Optional[str]   filename = None,
t.Optional[str]   state = None 
)
protected
Called by the parser to do the preprocessing and filtering
for all the extensions.  Returns a :class:`~jinja2.lexer.TokenStream`.

◆ add_extension()

None jinja2.environment.Environment.add_extension (   self,
t.Union[str, t.Type["Extension"]]  extension 
)
Adds an extension after the environment was created.

.. versionadded:: 2.5

◆ call_filter()

t.Any jinja2.environment.Environment.call_filter (   self,
str  name,
t.Any  value,
t.Optional[t.Sequence[t.Any]]   args = None,
t.Optional[t.Mapping[str, t.Any]]   kwargs = None,
t.Optional[Context]   context = None,
t.Optional[EvalContext]   eval_ctx = None 
)
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

◆ call_test()

t.Any jinja2.environment.Environment.call_test (   self,
str  name,
t.Any  value,
t.Optional[t.Sequence[t.Any]]   args = None,
t.Optional[t.Mapping[str, t.Any]]   kwargs = None,
t.Optional[Context]   context = None,
t.Optional[EvalContext]   eval_ctx = None 
)
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

◆ compile()

t.Union[str, CodeType] jinja2.environment.Environment.compile (   self,
t.Union[str, nodes.Template source,
t.Optional[str]   name = None,
t.Optional[str]   filename = None,
bool   raw = False,
bool   defer_init = False 
)
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.

◆ compile_expression()

"TemplateExpression" jinja2.environment.Environment.compile_expression (   self,
str  source,
bool   undefined_to_none = True 
)
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

◆ compile_templates()

None jinja2.environment.Environment.compile_templates (   self,
t.Union[str, "os.PathLike[str]"]  target,
t.Optional[t.Collection[str]]   extensions = None,
t.Optional[t.Callable[[str], bool]]   filter_func = None,
t.Optional[str]   zip = "deflated",
t.Optional[t.Callable[[str], None]]   log_function = None,
bool   ignore_errors = True 
)
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

◆ extend()

None jinja2.environment.Environment.extend (   self,
**t.Any  attributes 
)
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.

◆ from_string()

"Template" jinja2.environment.Environment.from_string (   self,
t.Union[str, nodes.Template source,
t.Optional[t.MutableMapping[str, t.Any]]   globals = None,
t.Optional[t.Type["Template"]]   template_class = None 
)
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.

◆ get_or_select_template()

"Template" jinja2.environment.Environment.get_or_select_template (   self,
t.Union[ str, "Template", t.List[t.Union[str, "Template"]] ]  template_name_or_list,
t.Optional[str]   parent = None,
t.Optional[t.MutableMapping[str, t.Any]]   globals = None 
)
Use :meth:`select_template` if an iterable of template names
is given, or :meth:`get_template` if one name is given.

.. versionadded:: 2.3

◆ get_template()

"Template" jinja2.environment.Environment.get_template (   self,
t.Union[str, "Template"]  name,
t.Optional[str]   parent = None,
t.Optional[t.MutableMapping[str, t.Any]]   globals = None 
)
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.

◆ getattr()

t.Any jinja2.environment.Environment.getattr (   self,
t.Any  obj,
str  attribute 
)
Get an item or attribute of an object but prefer the attribute.
Unlike :meth:`getitem` the attribute *must* be a string.

Reimplemented in jinja2.sandbox.SandboxedEnvironment.

◆ getitem()

t.Union[t.Any, Undefined] jinja2.environment.Environment.getitem (   self,
t.Any  obj,
t.Union[str, t.Any]   argument 
)
Get an item or attribute of an object but prefer the item.

Reimplemented in jinja2.sandbox.SandboxedEnvironment.

◆ handle_exception()

"te.NoReturn" jinja2.environment.Environment.handle_exception (   self,
t.Optional[str]   source = None 
)
Exception handling helper.  This is used internally to either raise
rewritten exceptions or return a rendered traceback for the template.

◆ iter_extensions()

t.Iterator["Extension"] jinja2.environment.Environment.iter_extensions (   self)
Iterates over the extensions by priority.

◆ join_path()

str jinja2.environment.Environment.join_path (   self,
str  template,
str  parent 
)
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.

◆ lex()

t.Iterator[t.Tuple[int, str, str]] jinja2.environment.Environment.lex (   self,
str  source,
t.Optional[str]   name = None,
t.Optional[str]   filename = None 
)
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.

◆ lexer()

Lexer jinja2.environment.Environment.lexer (   self)
The lexer for this environment.

◆ list_templates()

t.List[str] jinja2.environment.Environment.list_templates (   self,
t.Optional[t.Collection[str]]   extensions = None,
t.Optional[t.Callable[[str], bool]]   filter_func = None 
)
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

◆ make_globals()

t.MutableMapping[str, t.Any] jinja2.environment.Environment.make_globals (   self,
t.Optional[t.MutableMapping[str, t.Any]]   d 
)
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.

◆ overlay()

"te.Self" jinja2.environment.Environment.overlay (   self,
str   block_start_string = missing,
str   block_end_string = missing,
str   variable_start_string = missing,
str   variable_end_string = missing,
str   comment_start_string = missing,
str   comment_end_string = missing,
t.Optional[str]   line_statement_prefix = missing,
t.Optional[str]   line_comment_prefix = missing,
bool   trim_blocks = missing,
bool   lstrip_blocks = missing,
"te.Literal['\\n', '\\r\\n', '\\r']"   newline_sequence = missing,
bool   keep_trailing_newline = missing,
t.Sequence[t.Union[str, t.Type["Extension"]]]   extensions = missing,
bool   optimized = missing,
t.Type[Undefined]   undefined = missing,
t.Optional[t.Callable[..., t.Any]]   finalize = missing,
t.Union[bool, t.Callable[[t.Optional[str]], bool]]   autoescape = missing,
t.Optional["BaseLoader"]   loader = missing,
int   cache_size = missing,
bool   auto_reload = missing,
t.Optional["BytecodeCache"]   bytecode_cache = missing,
bool   enable_async = missing 
)
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.5
    ``enable_async`` is applied correctly.

.. versionchanged:: 3.1.2
    Added the ``newline_sequence``, ``keep_trailing_newline``,
    and ``enable_async`` parameters to match ``__init__``.

◆ parse()

nodes.Template jinja2.environment.Environment.parse (   self,
str  source,
t.Optional[str]   name = None,
t.Optional[str]   filename = None 
)
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.

◆ preprocess()

str jinja2.environment.Environment.preprocess (   self,
str  source,
t.Optional[str]   name = None,
t.Optional[str]   filename = None 
)
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.

◆ select_template()

"Template" jinja2.environment.Environment.select_template (   self,
t.Iterable[t.Union[str, "Template"]]  names,
t.Optional[str]   parent = None,
t.Optional[t.MutableMapping[str, t.Any]]   globals = None 
)
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

The documentation for this class was generated from the following file: