class jinja2.environment.CodeGenerator(environment, name, filename, stream=None, defer_init=False)[source]


__init__(environment, name, filename[, ...])
blockvisit(nodes, frame) Visit a list of nodes as block in a frame.
buffer(frame) Enable buffering for the frame from that point onwards.
end_write(frame) End the writing process started by start_write.
export_assigned_vars(frame, assignment_frame)
fail(msg, lineno) Fail with a TemplateAssertionError.
function_scoping(node, frame[, children, ...]) In Jinja a few statements require the help of anonymous functions.
generic_visit(node, *args, **kwargs) Called if no explicit visitor function exists for a node.
get_visitor(node) Return the visitor function for this node or None if no visitor exists for this node.
indent() Indent by one.
macro_body(node, frame[, children]) Dump the function def of a macro or call block.
macro_def(node, frame) Dump the macro definition for the def created by macro_body.
newline([node, extra]) Add one or more newlines before the next write.
outdent([step]) Outdent by step.
pop_scope(aliases, frame) Restore all aliases and delete unused variables.
position(node) Return a human readable position for the node.
pull_dependencies(nodes) Pull all the dependencies.
pull_locals(frame) Pull all the references identifiers into the local scope.
push_scope(frame[, extra_vars]) This function returns all the shadowed variables in a dict in the form name: alias and will write the required assignments into the current scope.
return_buffer_contents(frame) Return the buffer contents of the frame.
signature(node, frame[, extra_kwargs]) Writes a function call to the stream for the current node.
simple_write(s, frame[, node]) Simple shortcut for start_write + write + end_write.
start_write(frame[, node]) Yield or write into the frame buffer.
temporary_identifier() Get a new unique identifier.
unoptimize_scope(frame) Disable Python optimizations for the frame.
visit(node, *args, **kwargs) Visit a node.
visit_Add(node, frame)
visit_And(node, frame)
visit_Assign(node, frame)
visit_AssignBlock(node, frame)
visit_Block(node, frame) Call a block and register it for the template.
visit_Break(node, frame)
visit_Call(node, frame[, forward_caller])
visit_CallBlock(node, frame)
visit_Compare(node, frame)
visit_Concat(node, frame)
visit_CondExpr(node, frame)
visit_Const(node, frame)
visit_ContextReference(node, frame)
visit_Continue(node, frame)
visit_Dict(node, frame)
visit_Div(node, frame)
visit_EnvironmentAttribute(node, frame)
visit_EvalContextModifier(node, frame)
visit_ExprStmt(node, frame)
visit_Extends(node, frame) Calls the extender.
visit_ExtensionAttribute(node, frame)
visit_Filter(node, frame)
visit_FilterBlock(node, frame)
visit_FloorDiv(node, frame)
visit_For(node, frame)
visit_FromImport(node, frame) Visit named imports.
visit_Getattr(node, frame)
visit_Getitem(node, frame)
visit_If(node, frame)
visit_Import(node, frame) Visit regular imports.
visit_ImportedName(node, frame)
visit_Include(node, frame) Handles includes.
visit_InternalName(node, frame)
visit_Keyword(node, frame)
visit_List(node, frame)
visit_Macro(node, frame)
visit_MarkSafe(node, frame)
visit_MarkSafeIfAutoescape(node, frame)
visit_Mod(node, frame)
visit_Mul(node, frame)
visit_Name(node, frame)
visit_Neg(node, frame)
visit_Not(node, frame)
visit_Operand(node, frame)
visit_Or(node, frame)
visit_Output(node, frame)
visit_Pos(node, frame)
visit_Pow(node, frame)
visit_Scope(node, frame)
visit_ScopedEvalContextModifier(node, frame)
visit_Slice(node, frame)
visit_Sub(node, frame)
visit_Template(node[, frame])
visit_TemplateData(node, frame)
visit_Test(node, frame)
visit_Tuple(node, frame)
write(x) Write a string into the output stream.
writeline(x[, node, extra]) Combination of newline and write.