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

Method load

tools/inspector_protocol/jinja2/loaders.py:100–135  ·  view source on GitHub ↗

Loads a template. This method looks up the template in the cache or loads one by calling :meth:`get_source`. Subclasses should not override this method as loaders working on collections of other loaders (such as :class:`PrefixLoader` or :class:`ChoiceLoader`) will n

(self, environment, name, globals=None)

Source from the content-addressed store, hash-verified

98
99 @internalcode
100 def load(self, environment, name, globals=None):
101 """Loads a template. This method looks up the template in the cache
102 or loads one by calling :meth:`get_source`. Subclasses should not
103 override this method as loaders working on collections of other
104 loaders (such as :class:`PrefixLoader` or :class:`ChoiceLoader`)
105 will not call this method but `get_source` directly.
106 """
107 code = None
108 if globals is None:
109 globals = {}
110
111 # first we try to get the source for this template together
112 # with the filename and the uptodate function.
113 source, filename, uptodate = self.get_source(environment, name)
114
115 # try to load the code from the bytecode cache if there is a
116 # bytecode cache configured.
117 bcc = environment.bytecode_cache
118 if bcc is not None:
119 bucket = bcc.get_bucket(environment, name, filename, source)
120 code = bucket.code
121
122 # if we don't have code so far (not cached, no longer up to
123 # date) etc. we compile the template
124 if code is None:
125 code = environment.compile(source, name, filename)
126
127 # if the bytecode cache is available and the bucket doesn't
128 # have a code so far, we give the bucket the new code and put
129 # it back to the bytecode cache.
130 if bcc is not None and bucket.code is None:
131 bucket.code = code
132 bcc.set_bucket(bucket)
133
134 return environment.template_class.from_code(environment, code,
135 globals, uptodate)
136
137
138class FileSystemLoader(BaseLoader):

Callers 11

MainFunction · 0.45
get_v8_configFunction · 0.45
compress_json.pyFile · 0.45
loadMethod · 0.45
loadMethod · 0.45
_load_templateMethod · 0.45
marshal_loadFunction · 0.45
load_bytecodeMethod · 0.45
LoadEdgesFunction · 0.45
InitMethod · 0.45
icutrim.pyFile · 0.45

Calls 5

get_sourceMethod · 0.95
get_bucketMethod · 0.45
compileMethod · 0.45
set_bucketMethod · 0.45
from_codeMethod · 0.45

Tested by

no test coverage detected