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

Function main

misc/log_trace_check.py:44–81  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42
43
44def main() -> None:
45 parser = argparse.ArgumentParser(
46 description="Compile mypy and collect a trace log while type checking (by default, self check)."
47 )
48 parser.add_argument(
49 "--multi-file",
50 action="store_true",
51 help="compile mypy into one C file per module (to reduce RAM use during compilation)",
52 )
53 parser.add_argument(
54 "--skip-compile", action="store_true", help="use compiled mypy from previous run"
55 )
56 parser.add_argument(
57 "-c",
58 metavar="CODE",
59 default=None,
60 type=str,
61 help="type check Python code fragment instead of mypy self-check",
62 )
63 args = parser.parse_args()
64 multi_file: bool = args.multi_file
65 skip_compile: bool = args.skip_compile
66 code: str | None = args.c
67
68 target_dir = TARGET_DIR
69
70 if not skip_compile:
71 clone(target_dir, "HEAD")
72
73 print(f"Building mypy in {target_dir} with trace logging enabled...")
74 build_mypy(target_dir, multi_file, log_trace=True, opt_level="0")
75 elif not os.path.isdir(target_dir):
76 sys.exit("error: Can't find compile mypy from previous run -- can't use --skip-compile")
77
78 perform_type_check(target_dir, code)
79
80 trace_fnam = os.path.join(target_dir, "mypyc_trace.txt")
81 print(f"Generated event trace log in {trace_fnam}")
82
83
84if __name__ == "__main__":

Callers 1

log_trace_check.pyFile · 0.70

Calls 8

cloneFunction · 0.90
build_mypyFunction · 0.90
printFunction · 0.85
perform_type_checkFunction · 0.85
add_argumentMethod · 0.80
exitMethod · 0.80
isdirMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…