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

Function json_dump

lib/matplotlib/font_manager.py:1159–1180  ·  view source on GitHub ↗

Dump `FontManager` *data* as JSON to the file named *filename*. See Also -------- json_load Notes ----- File paths that are children of the Matplotlib data path (typically, fonts shipped with Matplotlib) are stored relative to that data path (to remain valid ac

(data, filename)

Source from the content-addressed store, hash-verified

1157
1158
1159def json_dump(data, filename):
1160 """
1161 Dump `FontManager` *data* as JSON to the file named *filename*.
1162
1163 See Also
1164 --------
1165 json_load
1166
1167 Notes
1168 -----
1169 File paths that are children of the Matplotlib data path (typically, fonts
1170 shipped with Matplotlib) are stored relative to that data path (to remain
1171 valid across virtualenvs).
1172
1173 This function temporarily locks the output file to prevent multiple
1174 processes from overwriting one another's output.
1175 """
1176 try:
1177 with cbook._lock_path(filename), open(filename, 'w') as fh:
1178 json.dump(data, fh, cls=_JSONEncoder, indent=2)
1179 except OSError as e:
1180 _log.warning('Could not save font_manager cache %s', e)
1181
1182
1183def json_load(filename):

Callers 2

test_json_serializationFunction · 0.90
_load_fontmanagerFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_json_serializationFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…