module documentation

provides functionality for rendering a parsetree constructing into module source code.

Class LoopVariable A node visitor which looks for the name 'loop' within undeclared identifiers.
Function compile Generate module source code given a parsetree node, uri, and optional source filename
Function mangle_mako_loop converts a for loop into a context manager wrapped around a for loop when access to the `loop` variable has been detected in the for loop body
Constant MAGIC_NUMBER Undocumented
Constant RESERVED_NAMES Undocumented
Constant TOPLEVEL_DECLARED Undocumented
Class _CompileContext Undocumented
Class _GenerateRenderMethod A template visitor object which generates the full module source for a template.
Class _Identifiers tracks the status of identifier names as template code is rendered.
Constant _FOR_LOOP Undocumented
def compile(node, uri, filename=None, default_filters=None, buffer_filters=None, imports=None, future_imports=None, source_encoding=None, generate_magic_comment=True, strict_undefined=False, enable_loop=True, reserved_names=frozenset()): (source)

Generate module source code given a parsetree node, uri, and optional source filename

def mangle_mako_loop(node, printer): (source)

converts a for loop into a context manager wrapped around a for loop when access to the `loop` variable has been detected in the for loop body

MAGIC_NUMBER: int = (source)

Undocumented

Value
10
RESERVED_NAMES = (source)

Undocumented

Value
{'context', 'loop'}.union(TOPLEVEL_DECLARED)
TOPLEVEL_DECLARED: set[str] = (source)

Undocumented

Value
set(['UNDEFINED', 'STOP_RENDERING'])
_FOR_LOOP = (source)

Undocumented

Value
re.compile(r'^for\s+((?:\(?)\s*(?:\(?)\s*[A-Za-z_][A-Za-z_0-9]*(?:\s*,\s*(?:[A-Z
a-z_][A-Za-z_0-9]*),??)*\s*(?:\)?)(?:\s*,\s*(?:(?:\(?)\s*[A-Za-z_][A-Za-z_0-9]*(
?:\s*,\s*(?:[A-Za-z_][A-Za-z_0-9]*),??)*\s*(?:\)?)),??)*\s*(?:\)?))\s+in\s+(.*):'
)