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

Method extend

src/jinja2/environment.py:377–384  ·  view source on GitHub ↗

Add the items to the instance of the environment if they do not exist yet. This is used by :ref:`extensions <writing-extensions>` to register callbacks and configuration values without breaking inheritance.

(self, **attributes: t.Any)

Source from the content-addressed store, hash-verified

375 self.extensions.update(load_extensions(self, [extension]))
376
377 def extend(self, **attributes: t.Any) -> None:
378 """Add the items to the instance of the environment if they do not exist
379 yet. This is used by :ref:`extensions <writing-extensions>` to register
380 callbacks and configuration values without breaking inheritance.
381 """
382 for key, value in attributes.items():
383 if not hasattr(self, key):
384 setattr(self, key, value)
385
386 def overlay(
387 self,

Callers 13

__init__Method · 0.80
list_templatesMethod · 0.80
__init__Method · 0.80
_make_nodeMethod · 0.80
copyMethod · 0.80
subparseMethod · 0.80
generic_visitMethod · 0.80
__new__Method · 0.80
set_ctxMethod · 0.80
set_linenoMethod · 0.80
set_environmentMethod · 0.80
args_as_constFunction · 0.80

Calls 1

itemsMethod · 0.80

Tested by

no test coverage detected