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

Function load_extensions

src/jinja2/environment.py:108–123  ·  view source on GitHub ↗

Load the extensions from the list and bind it to the environment. Returns a dict of instantiated extensions.

(
    environment: "Environment",
    extensions: t.Sequence[t.Union[str, t.Type["Extension"]]],
)

Source from the content-addressed store, hash-verified

106
107
108def load_extensions(
109 environment: "Environment",
110 extensions: t.Sequence[t.Union[str, t.Type["Extension"]]],
111) -> t.Dict[str, "Extension"]:
112 """Load the extensions from the list and bind it to the environment.
113 Returns a dict of instantiated extensions.
114 """
115 result = {}
116
117 for extension in extensions:
118 if isinstance(extension, str):
119 extension = t.cast(t.Type["Extension"], import_string(extension))
120
121 result[extension.identifier] = extension(environment)
122
123 return result
124
125
126def _environment_config_check(environment: _env_bound) -> _env_bound:

Callers 3

__init__Method · 0.85
add_extensionMethod · 0.85
overlayMethod · 0.85

Calls 1

import_stringFunction · 0.85

Tested by

no test coverage detected