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)
| 1157 | |
| 1158 | |
| 1159 | def 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 | |
| 1183 | def json_load(filename): |
no outgoing calls
searching dependent graphs…