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

Method derived

src/jinja2/runtime.py:310–320  ·  view source on GitHub ↗

Internal helper function to create a derived context. This is used in situations where the system needs a new context in the same template that is independent.

(self, locals: t.Optional[t.Dict[str, t.Any]] = None)

Source from the content-addressed store, hash-verified

308 )
309
310 def derived(self, locals: t.Optional[t.Dict[str, t.Any]] = None) -> "Context":
311 """Internal helper function to create a derived context. This is
312 used in situations where the system needs a new context in the same
313 template that is independent.
314 """
315 context = new_context(
316 self.environment, self.name, {}, self.get_all(), True, None, locals
317 )
318 context.eval_ctx = self.eval_ctx
319 context.blocks.update((k, list(v)) for k, v in self.blocks.items())
320 return context
321
322 keys = _dict_method_all(dict.keys)
323 values = _dict_method_all(dict.values)

Callers 1

callMethod · 0.80

Calls 3

get_allMethod · 0.95
new_contextFunction · 0.85
itemsMethod · 0.80

Tested by

no test coverage detected