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

Function main

mypy/exportjson.py:581–608  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

579
580
581def main() -> None:
582 parser = argparse.ArgumentParser(
583 description="Convert binary cache files to JSON. "
584 "Create files in the same directory with extra .json extension."
585 )
586 parser.add_argument(
587 "path", nargs="+", help="mypy cache data file to convert (.data.ff extension)"
588 )
589 args = parser.parse_args()
590 fnams: list[str] = args.path
591 for fnam in fnams:
592 if fnam.endswith(".data.ff"):
593 is_data = True
594 elif fnam.endswith(".meta.ff"):
595 is_data = False
596 else:
597 sys.exit(f"error: Expected .data.ff or .meta.ff extension, but got {fnam}")
598 with open(fnam, "rb") as f:
599 data = f.read()
600 if is_data:
601 json_data = convert_binary_cache_to_json(data)
602 else:
603 data_file = fnam.removesuffix(".meta.ff") + ".data.ff"
604 json_data = convert_binary_cache_meta_to_json(data, data_file)
605 new_fnam = fnam + ".json"
606 with open(new_fnam, "w") as f:
607 json.dump(json_data, f)
608 print(f"{fnam} -> {new_fnam}")
609
610
611if __name__ == "__main__":

Callers 1

exportjson.pyFile · 0.70

Calls 9

printFunction · 0.85
add_argumentMethod · 0.80
exitMethod · 0.80
removesuffixMethod · 0.80
endswithMethod · 0.45
readMethod · 0.45
dumpMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…