MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / get_template

Function get_template

src/formattedcode/output_html.py:171–184  ·  view source on GitHub ↗

Return a Jinja template object loaded from the file at `location`.

(location)

Source from the content-addressed store, hash-verified

169
170
171def get_template(location):
172 """
173 Return a Jinja template object loaded from the file at `location`.
174 """
175 from jinja2 import Environment, FileSystemLoader
176
177 location = as_posixpath(abspath(expanduser(location)))
178 assert isfile(location)
179
180 template_dir = parent_directory(location)
181 env = Environment(loader=FileSystemLoader(template_dir))
182
183 template_name = file_name(location)
184 return env.get_template(template_name)
185
186
187def generate_output(results, license_references, version, template):

Callers 2

write_templatedFunction · 0.85
create_html_appFunction · 0.85

Calls 4

as_posixpathFunction · 0.90
parent_directoryFunction · 0.90
file_nameFunction · 0.90
EnvironmentClass · 0.85

Tested by

no test coverage detected