module documentation

Classes for managing templates and their runtime and compile time options.
Class ​Environment No summary
Class ​Template A compiled template that can be rendered.
Class ​Template​Stream No summary
Class ​Template​Expression The jinja2.Environment.compile_expression method returns an instance of this object. It encapsulates the expression-like access to the template with an expression it wraps.
Class ​Template​Module Represents an imported template. All the exported names of the template are available as attributes on this object. Additionally converting it into a string renders the contents.
Function ​_environment​_config​_check Perform a sanity check on the environment.
Function copy​_cache Create an empty copy of the given cache.
Function create​_cache Return the cache class for the given size.
Function get​_spontaneous​_environment Return a new spontaneous environment. A spontaneous environment is used for templates created directly rather than through an existing environment.
Function load​_extensions Load the extensions from the list and bind it to the environment. Returns a dict of instantiated extensions.
Variable ​_env​_bound Undocumented
def _environment_config_check(environment):
Perform a sanity check on the environment.
Parameters
environment:EnvironmentUndocumented
Returns
EnvironmentUndocumented
def copy_cache(cache):
Create an empty copy of the given cache.
Parameters
cache:t.Optional[t.MutableMapping]Undocumented
Returns
t.Optional[t.MutableMapping[t.Tuple[weakref.ref, str], Template]]Undocumented
def create_cache(size):
Return the cache class for the given size.
Parameters
size:intUndocumented
Returns
t.Optional[t.MutableMapping[t.Tuple[weakref.ref, str], Template]]Undocumented
@lru_cache(maxsize=10)
def get_spontaneous_environment(cls, *args):
Return a new spontaneous environment. A spontaneous environment is used for templates created directly rather than through an existing environment.
Parameters
cls:t.Type[_env_bound]Environment class to create.
*args:t.AnyPositional arguments passed to environment.
Returns
_env_boundUndocumented
def load_extensions(environment, extensions):
Load the extensions from the list and bind it to the environment. Returns a dict of instantiated extensions.
Parameters
environment:EnvironmentUndocumented
extensions:t.Sequence[t.Union[str, t.Type[Extension]]]Undocumented
Returns
t.Dict[str, Extension]Undocumented
_env_bound =

Undocumented