MCPcopy Index your code
hub / github.com/python/mypy / write_cache_meta

Function write_cache_meta

mypy/build.py:2408–2424  ·  view source on GitHub ↗
(meta: CacheMeta, manager: BuildManager, meta_file: str)

Source from the content-addressed store, hash-verified

2406
2407
2408def write_cache_meta(meta: CacheMeta, manager: BuildManager, meta_file: str) -> None:
2409 # Write meta cache file
2410 metastore = manager.metastore
2411 if manager.options.fixed_format_cache:
2412 data_io = WriteBuffer()
2413 meta.write(data_io)
2414 # Prefix with both low- and high-level cache format versions for future validation.
2415 # TODO: switch to something like librt.internal.write_byte() if this is slow.
2416 meta_bytes = bytes([cache_version(), CACHE_VERSION]) + data_io.getvalue()
2417 else:
2418 meta_dict = meta.serialize()
2419 meta_bytes = json_dumps(meta_dict, manager.options.debug_cache)
2420 if not metastore.write(meta_file, meta_bytes):
2421 # Most likely the error is the replace() call
2422 # (see https://github.com/python/mypy/issues/3215).
2423 # The next run will simply find the cache entry out of date.
2424 manager.log(f"Error writing cache meta file {meta_file}")
2425
2426
2427def write_cache_meta_ex(meta_file: str, meta_ex: CacheMetaEx, manager: BuildManager) -> None:

Callers 3

validate_metaFunction · 0.85
process_stale_sccFunction · 0.85

Calls 5

json_dumpsFunction · 0.90
bytesClass · 0.85
writeMethod · 0.45
serializeMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…