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

Function main

Parser/asdl_c.py:2437–2462  ·  view source on GitHub ↗
(input_filename, c_filename, h_filename, internal_h_filename, dump_module=False)

Source from the content-addressed store, hash-verified

2435 v.visit(mod)
2436
2437def main(input_filename, c_filename, h_filename, internal_h_filename, dump_module=False):
2438 auto_gen_msg = AUTOGEN_MESSAGE.format("/".join(Path(__file__).parts[-2:]))
2439 mod = asdl.parse(input_filename)
2440 if dump_module:
2441 print('Parsed Module:')
2442 print(mod)
2443 if not asdl.check(mod):
2444 sys.exit(1)
2445
2446 metadata_visitor = MetadataVisitor()
2447 metadata_visitor.visit(mod)
2448 metadata = metadata_visitor.metadata
2449
2450 with c_filename.open("w") as c_file, \
2451 h_filename.open("w") as h_file, \
2452 internal_h_filename.open("w") as internal_h_file:
2453 c_file.write(auto_gen_msg)
2454 h_file.write(auto_gen_msg)
2455 internal_h_file.write(auto_gen_msg)
2456
2457 write_internal_h_header(mod, internal_h_file)
2458 write_source(mod, metadata, c_file, internal_h_file)
2459 write_header(mod, metadata, h_file)
2460 write_internal_h_footer(mod, internal_h_file)
2461
2462 print(f"{c_filename}, {h_filename}, {internal_h_filename} regenerated.")
2463
2464if __name__ == "__main__":
2465 parser = ArgumentParser()

Callers 1

asdl_c.pyFile · 0.70

Calls 14

PathClass · 0.90
MetadataVisitorClass · 0.85
write_internal_h_headerFunction · 0.85
write_sourceFunction · 0.85
write_internal_h_footerFunction · 0.85
write_headerFunction · 0.70
formatMethod · 0.45
joinMethod · 0.45
parseMethod · 0.45
checkMethod · 0.45
exitMethod · 0.45
visitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…