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

Function _extract

tests/test_python_module_instance_calls.py:7–21  ·  view source on GitHub ↗
(tmp_path, source, service="Svc")

Source from the content-addressed store, hash-verified

5
6
7def _extract(tmp_path, source, service="Svc"):
8 package = tmp_path / "pkg"
9 package.mkdir(exist_ok=True)
10 (package / "__init__.py").write_text("", encoding="utf-8")
11 (package / "service.py").write_text(
12 f"class {service}:\n def create(self): return 1\n", encoding="utf-8"
13 )
14 (package / "caller.py").write_text(source, encoding="utf-8")
15 result = extract(sorted(package.glob("*.py")), root=tmp_path,
16 cache_root=tmp_path / "graphify-out", parallel=False)
17 nodes = {node["id"]: node for node in result["nodes"]}
18 return [edge for edge in result["edges"]
19 if edge["relation"] == "calls"
20 and nodes[edge["source"]]["label"] == "run()"
21 and nodes[edge["target"]]["label"] == ".create()"]
22
23
24@pytest.mark.parametrize("service,instance", [("Svc", "g"), ("lower_svc", "lower_svc"),

Calls 1

extractFunction · 0.90

Tested by

no test coverage detected