module documentation

The runtime functions and state used by compiled templates.
Class ​Chainable​Undefined An undefined that is chainable, where both __getattr__ and __getitem__ return itself rather than raising an UndefinedError.
Class ​Context No summary
Class ​Debug​Undefined An undefined that returns the debug info when printed.
Class ​Strict​Undefined An undefined that barks on print and iteration as well as boolean tests and all kinds of comparisons. In other words: you can do nothing with it except checking if it's defined using the defined test.
Class ​Undefined The default undefined type. This undefined type can be printed and iterated over, but every other access will raise an UndefinedError:
Constant F Undocumented
Constant V Undocumented
Variable async​_exported Undocumented
Variable exported Undocumented
Class ​Async​Loop​Context Undocumented
Class ​Block​Reference One block on a template reference.
Class ​Loop​Context A wrapper iterable for dynamic for loops, with information about the loop and iteration.
Class ​Loop​Render​Func Undocumented
Class ​Macro Wraps a macro function.
Class ​Template​Reference The self in templates.
Function ​_dict​_method​_all Undocumented
Function identity Returns its argument. Useful for certain things in the environment.
Function make​_logging​_undefined Given a logger object this returns a new undefined class that will log certain failures. It will log iterations and printing. If no logger is given a default logger is created.
Function markup​_join Concatenation that escapes if necessary and converts to string.
Function new​_context Internal helper for context creation.
Function str​_join Simple args to string conversion and concatenation.
Function unicode​_join Undocumented
F =

Undocumented

Value
t.TypeVar('F',
          bound=t.Callable[..., t.Any])
V =

Undocumented

Value
t.TypeVar('V')
async_exported: list[str] =

Undocumented

exported: list[str] =

Undocumented

def _dict_method_all(dict_method):

Undocumented

Parameters
dict​_method:FUndocumented
Returns
FUndocumented
def identity(x):
Returns its argument. Useful for certain things in the environment.
Parameters
x:VUndocumented
Returns
VUndocumented
def make_logging_undefined(logger=None, base=Undefined):

Given a logger object this returns a new undefined class that will log certain failures. It will log iterations and printing. If no logger is given a default logger is created.

Example:

logger = logging.getLogger(__name__)
LoggingUndefined = make_logging_undefined(
    logger=logger,
    base=Undefined
)
New in version 2.8.
Parameters
logger:t.Optional[logging.Logger]the logger to use. If not provided, a default logger is created.
base:t.Type[Undefined]the base class to add logging functionality to. This defaults to Undefined.
Returns
t.Type[Undefined]Undocumented
def markup_join(seq):
Concatenation that escapes if necessary and converts to string.
Parameters
seq:t.Iterable[t.Any]Undocumented
Returns
strUndocumented
def new_context(environment, template_name, blocks, vars=None, shared=False, globals=None, locals=None):
Internal helper for context creation.
Parameters
environment:EnvironmentUndocumented
template​_name:t.Optional[str]Undocumented
blocks:t.Dict[str, t.Callable[[Context], t.Iterator[str]]]Undocumented
vars:t.Optional[t.Dict[str, t.Any]]Undocumented
shared:boolUndocumented
globals:t.Optional[t.MutableMapping[str, t.Any]]Undocumented
locals:t.Optional[t.Mapping[str, t.Any]]Undocumented
Returns
ContextUndocumented
def str_join(seq):
Simple args to string conversion and concatenation.
Parameters
seq:t.Iterable[t.Any]Undocumented
Returns
strUndocumented
def unicode_join(seq):

Undocumented

Parameters
seq:t.Iterable[t.Any]Undocumented
Returns
strUndocumented