MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / extract_python

Function extract_python

graphify/extract.py:2466–2473  ·  view source on GitHub ↗

Extract classes, functions, and imports from a .py file via tree-sitter AST.

(path: Path, *, root: Path | None = None)

Source from the content-addressed store, hash-verified

2464# ── Public API ────────────────────────────────────────────────────────────────
2465
2466def extract_python(path: Path, *, root: Path | None = None) -> dict:
2467 """Extract classes, functions, and imports from a .py file via tree-sitter AST."""
2468 result = _extract_generic(path, _PYTHON_CONFIG, scan_root=root)
2469 # Taken unconditionally: the slot must not outlive the call that filled it.
2470 parsed = take_python_parse(str(path))
2471 if "error" not in result:
2472 _extract_python_rationale(path, result, parsed)
2473 return result
2474
2475
2476_TS_TYPED_TAG_RE = re.compile(

Calls 3

_extract_genericFunction · 0.90
take_python_parseFunction · 0.90