MCPcopy Index your code
hub / github.com/nodejs/node / TemplateExpression

Class TemplateExpression

tools/inspector_protocol/jinja2/environment.py:1171–1187  ·  view source on GitHub ↗

The :meth:`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.

Source from the content-addressed store, hash-verified

1169
1170
1171class TemplateExpression(object):
1172 """The :meth:`jinja2.Environment.compile_expression` method returns an
1173 instance of this object. It encapsulates the expression-like access
1174 to the template with an expression it wraps.
1175 """
1176
1177 def __init__(self, template, undefined_to_none):
1178 self._template = template
1179 self._undefined_to_none = undefined_to_none
1180
1181 def __call__(self, *args, **kwargs):
1182 context = self._template.new_context(dict(*args, **kwargs))
1183 consume(self._template.root_render_func(context))
1184 rv = context.vars['result']
1185 if self._undefined_to_none and isinstance(rv, Undefined):
1186 rv = None
1187 return rv
1188
1189
1190@implements_iterator

Callers 1

compile_expressionMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…