class documentation

class ModuleLoader(BaseLoader):

View In Hierarchy

This loader loads templates from precompiled templates.

Example usage:

>>> loader = ChoiceLoader([
...     ModuleLoader('/path/to/compiled/templates'),
...     FileSystemLoader('/path/to/templates')
... ])

Templates can be precompiled with Environment.compile_templates.

Static Method get​_module​_filename Undocumented
Static Method get​_template​_key Undocumented
Method __init__ Undocumented
Method load No summary
Class Variable has​_source​_access Undocumented
Instance Variable module Undocumented
Instance Variable package​_name Undocumented

Inherited from BaseLoader:

Method get​_source No summary
Method list​_templates Iterates over all templates. If the loader does not support that it should raise a TypeError which is the default behavior.
@staticmethod
def get_module_filename(name):

Undocumented

Parameters
name:strUndocumented
Returns
strUndocumented
@staticmethod
def get_template_key(name):

Undocumented

Parameters
name:strUndocumented
Returns
strUndocumented
def __init__(self, path):

Undocumented

Parameters
path:t.Union[str, os.PathLike, t.Sequence[t.Union[str, os.PathLike]]]Undocumented
@internalcode
def load(self, environment, name, globals=None):
Loads a template. This method looks up the template in the cache or loads one by calling get_source. Subclasses should not override this method as loaders working on collections of other loaders (such as PrefixLoader or ChoiceLoader) will not call this method but get_source directly.
Parameters
environment:EnvironmentUndocumented
name:strUndocumented
globals:t.Optional[t.MutableMapping[str, t.Any]]Undocumented
Returns
TemplateUndocumented
has_source_access: bool =
module =

Undocumented

package_name =

Undocumented