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

Function callees

__tests__/python-function-local-from-import.test.ts:35–45  ·  view source on GitHub ↗

The `calls` edges out of the function with this qualified name in `file`, as `name@file`.

(file: string, qualified: string)

Source from the content-addressed store, hash-verified

33
34/** The `calls` edges out of the function with this qualified name in `file`, as `name@file`. */
35function callees(file: string, qualified: string): string[] {
36 const from = cg!.getNodesByKind('function').find((n) => n.filePath === file && n.qualifiedName === qualified);
37 expect(from, `${qualified} should be indexed in ${file}`).toBeDefined();
38 return cg!
39 .getOutgoingEdges(from!.id)
40 .filter((e) => e.kind === 'calls')
41 .map((e) => cg!.getNode(e.target))
42 .filter((n): n is NonNullable<typeof n> => !!n)
43 .map((n) => `${n.qualifiedName}@${n.filePath}`)
44 .sort();
45}
46
47const CORE = { 'pkg/__init__.py': '', 'pkg/core.py': 'def reverts(raw):\n return [raw]\n' };
48

Calls 4

mapMethod · 0.80
getNodeMethod · 0.80
getNodesByKindMethod · 0.65
getOutgoingEdgesMethod · 0.45

Tested by

no test coverage detected