MCPcopy
hub / github.com/pallets/jinja / write_commons

Method write_commons

src/jinja2/compiler.py:723–734  ·  view source on GitHub ↗

Writes a common preamble that is used by root and block functions. Primarily this sets up common local helpers and enforces a generator through a dead branch.

(self)

Source from the content-addressed store, hash-verified

721 return f"{{{items_kv}}}"
722
723 def write_commons(self) -> None:
724 """Writes a common preamble that is used by root and block functions.
725 Primarily this sets up common local helpers and enforces a generator
726 through a dead branch.
727 """
728 self.writeline("resolve = context.resolve_or_missing")
729 self.writeline("undefined = environment.undefined")
730 self.writeline("concat = environment.concat")
731 # always use the standard Undefined class for the implicit else of
732 # conditional expressions
733 self.writeline("cond_expr_undefined = Undefined")
734 self.writeline("if 0: yield None")
735
736 def push_parameter_definitions(self, frame: Frame) -> None:
737 """Pushes all parameter targets from the given frame into a local

Callers 1

visit_TemplateMethod · 0.95

Calls 1

writelineMethod · 0.95

Tested by

no test coverage detected