MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / build_mpljs

Function build_mpljs

tools/embed_js.py:70–88  ·  view source on GitHub ↗
(web_backend_path, license_path)

Source from the content-addressed store, hash-verified

68
69
70def build_mpljs(web_backend_path, license_path):
71 mpljs_path = web_backend_path / "js/mpl.js"
72 mpljs_orig = mpljs_path.read_text().splitlines(keepends=True)
73 try:
74 mpljs_orig = mpljs_orig[:mpljs_orig.index(MPLJS_MAGIC_HEADER) + 1]
75 except IndexError as err:
76 raise ValueError(
77 f'The mpl.js file *must* have the exact line: {MPLJS_MAGIC_HEADER}'
78 ) from err
79
80 with mpljs_path.open('w') as mpljs:
81 mpljs.writelines(mpljs_orig)
82
83 for pkg in JAVASCRIPT_PACKAGES:
84 source, license = prep_package(web_backend_path, pkg)
85 mpljs.writelines(gen_embedded_lines(pkg, source))
86
87 shutil.copy(license,
88 license_path / f'LICENSE{safe_name(pkg.name)}')
89
90
91if __name__ == '__main__':

Callers 1

embed_js.pyFile · 0.85

Calls 6

prep_packageFunction · 0.85
gen_embedded_linesFunction · 0.85
safe_nameFunction · 0.85
indexMethod · 0.80
openMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…