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

Method _from_namespace

src/jinja2/environment.py:1248–1273  ·  view source on GitHub ↗
(
        cls,
        environment: Environment,
        namespace: t.MutableMapping[str, t.Any],
        globals: t.MutableMapping[str, t.Any],
    )

Source from the content-addressed store, hash-verified

1246
1247 @classmethod
1248 def _from_namespace(
1249 cls,
1250 environment: Environment,
1251 namespace: t.MutableMapping[str, t.Any],
1252 globals: t.MutableMapping[str, t.Any],
1253 ) -> "Template":
1254 t: Template = object.__new__(cls)
1255 t.environment = environment
1256 t.globals = globals
1257 t.name = namespace["name"]
1258 t.filename = namespace["__file__"]
1259 t.blocks = namespace["blocks"]
1260
1261 # render function and module
1262 t.root_render_func = namespace["root"]
1263 t._module = None
1264
1265 # debug and loader helpers
1266 t._debug_info = namespace["debug_info"]
1267 t._uptodate = None
1268
1269 # store the reference
1270 namespace["environment"] = environment
1271 namespace["__jinja_template__"] = t
1272
1273 return t
1274
1275 def render(self, *args: t.Any, **kwargs: t.Any) -> str:
1276 """This method accepts the same arguments as the `dict` constructor:

Callers 2

from_codeMethod · 0.80
from_module_dictMethod · 0.80

Calls 1

__new__Method · 0.45

Tested by

no test coverage detected