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

Function main

mypyc/__main__.py:39–68  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37
38
39def main() -> None:
40 build_dir = "build" # can this be overridden??
41 try:
42 os.mkdir(build_dir)
43 except FileExistsError:
44 pass
45
46 opt_level = os.getenv("MYPYC_OPT_LEVEL", "3")
47 debug_level = os.getenv("MYPYC_DEBUG_LEVEL", "1")
48 strict_dunder_typing = bool(int(os.getenv("MYPYC_STRICT_DUNDER_TYPING", "0")))
49 # If enabled, compiled code writes a sampled log of executed ops (or events) to
50 # mypyc_trace.txt.
51 log_trace = bool(int(os.getenv("MYPYC_LOG_TRACE", "0")))
52
53 setup_file = os.path.join(build_dir, "setup.py")
54 with open(setup_file, "w") as f:
55 f.write(
56 setup_format.format(
57 sys.argv[1:], opt_level, debug_level, strict_dunder_typing, log_trace
58 )
59 )
60
61 # We don't use run_setup (like we do in the test suite) because it throws
62 # away the error code from distutils, and we don't care about the slight
63 # performance loss here.
64 env = os.environ.copy()
65 base_path = os.path.join(os.path.dirname(__file__), "..")
66 env["PYTHONPATH"] = base_path + os.pathsep + env.get("PYTHONPATH", "")
67 cmd = subprocess.run([sys.executable, setup_file, "build_ext", "--inplace"], env=env)
68 sys.exit(cmd.returncode)
69
70
71if __name__ == "__main__":

Callers 1

__main__.pyFile · 0.70

Calls 9

boolClass · 0.85
intClass · 0.85
exitMethod · 0.80
joinMethod · 0.45
writeMethod · 0.45
formatMethod · 0.45
copyMethod · 0.45
getMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…