MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / main

Function main

scripts/gen-py-stdlib.py:397–428  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

395
396
397def main() -> int:
398 parser = argparse.ArgumentParser()
399 parser.add_argument(
400 "stdlib_root",
401 nargs="?",
402 default="/tmp/python-lsp-references/typeshed/stdlib",
403 )
404 parser.add_argument(
405 "output",
406 nargs="?",
407 default="internal/cbm/lsp/generated/python_stdlib_data.c",
408 )
409 args = parser.parse_args()
410
411 root = Path(args.stdlib_root).resolve()
412 if not root.is_dir():
413 print(f"error: {root} is not a directory", file=sys.stderr)
414 return 1
415
416 stubs = list(iter_module_stubs(root))
417 out_path = Path(args.output).resolve()
418 out_path.parent.mkdir(parents=True, exist_ok=True)
419 emit(stubs, out_path)
420
421 n_classes = sum(len(s.classes) for s in stubs)
422 n_methods = sum(sum(len(c.methods) for c in s.classes) for s in stubs)
423 n_funcs = sum(len(s.functions) for s in stubs)
424 print(
425 f"wrote {out_path}: {len(stubs)} modules, "
426 f"{n_classes} classes ({n_methods} methods), {n_funcs} free functions"
427 )
428 return 0
429
430
431if __name__ == "__main__":

Callers 1

gen-py-stdlib.pyFile · 0.70

Calls 2

iter_module_stubsFunction · 0.85
emitFunction · 0.85

Tested by

no test coverage detected