MCPcopy Index your code
hub / github.com/nodejs/node / get_source

Method get_source

tools/inspector_protocol/jinja2/loaders.py:70–91  ·  view source on GitHub ↗

Get the template source, filename and reload helper for a template. It's passed the environment and template name and has to return a tuple in the form ``(source, filename, uptodate)`` or raise a `TemplateNotFound` error if it can't locate the template. The source pa

(self, environment, template)

Source from the content-addressed store, hash-verified

68 has_source_access = True
69
70 def get_source(self, environment, template):
71 """Get the template source, filename and reload helper for a template.
72 It's passed the environment and template name and has to return a
73 tuple in the form ``(source, filename, uptodate)`` or raise a
74 `TemplateNotFound` error if it can't locate the template.
75
76 The source part of the returned tuple must be the source of the
77 template as unicode string or a ASCII bytestring. The filename should
78 be the name of the file on the filesystem if it was loaded from there,
79 otherwise `None`. The filename is used by python for the tracebacks
80 if no loader extension is used.
81
82 The last item in the tuple is the `uptodate` function. If auto
83 reloading is enabled it's always called to check if the template
84 changed. No arguments are passed so the function must store the
85 old state somewhere (for example in a closure). If it returns `False`
86 the template will be reloaded.
87 """
88 if not self.has_source_access:
89 raise RuntimeError('%s cannot provide access to the source' %
90 self.__class__.__name__)
91 raise TemplateNotFound(template)
92
93 def list_templates(self):
94 """Iterates over all templates. If the loader does not support that

Callers 4

loadMethod · 0.95
get_sourceMethod · 0.45
get_sourceMethod · 0.45
compile_templatesMethod · 0.45

Calls 1

TemplateNotFoundClass · 0.90

Tested by

no test coverage detected