MCPcopy Index your code
hub / github.com/gto76/python-cheatsheet / update_file

Function update_file

web/update_plots.py:99–103  ·  view source on GitHub ↗
(filename, figure)

Source from the content-addressed store, hash-verified

97#
98
99def update_file(filename, figure):
100 lines = read_file(filename)
101 f_json = figure.to_json(pretty=True).replace('\n', '\n ')
102 out = lines[:6] + [f' {f_json}\n', ' )\n', '};\n']
103 write_to_file(filename, out)
104
105
106def read_file(filename):

Callers 2

update_covid_deathsFunction · 0.85
mainFunction · 0.85

Calls 2

read_fileFunction · 0.70
write_to_fileFunction · 0.70

Tested by

no test coverage detected