MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / callsIn

Function callsIn

__tests__/python-self-call-not-import.test.ts:25–40  ·  view source on GitHub ↗
(files: Record<string, string>)

Source from the content-addressed store, hash-verified

23 });
24
25 async function callsIn(files: Record<string, string>): Promise<string[]> {
26 const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'codegraph-py-self-'));
27 dirs.push(dir);
28 for (const [rel, content] of Object.entries(files)) {
29 fs.mkdirSync(path.dirname(path.join(dir, rel)), { recursive: true });
30 fs.writeFileSync(path.join(dir, rel), content);
31 }
32 cg = await CodeGraph.init(dir, { index: true });
33 const rows = (cg as any).db.db
34 .prepare(
35 `SELECT s.qualified_name s, t.qualified_name t, t.file_path f FROM edges e
36 JOIN nodes s ON s.id = e.source JOIN nodes t ON t.id = e.target WHERE e.kind = 'calls'`,
37 )
38 .all() as { s: string; t: string; f: string }[];
39 return rows.map((r) => `${r.s} -> ${r.t} (${r.f})`).sort();
40 }
41
42 const httpkit = 'def get_ip(request):\n return "1.2.3.4"\n';
43

Calls 6

pushMethod · 0.80
mapMethod · 0.80
allMethod · 0.65
prepareMethod · 0.65
joinMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected