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

Function targets

__tests__/python-module-resolution.test.ts:41–51  ·  view source on GitHub ↗

`kind` edges leaving `fnName` in `file`, as `name@file` of each target.

(fnName: string, file: string, kind: 'calls' | 'imports')

Source from the content-addressed store, hash-verified

39
40 /** `kind` edges leaving `fnName` in `file`, as `name@file` of each target. */
41 function targets(fnName: string, file: string, kind: 'calls' | 'imports'): string[] {
42 const src = cg!
43 .getNodesInFile(file)
44 .find((n) => n.name === fnName && (n.kind === 'function' || n.kind === 'file'));
45 expect(src, `${fnName} in ${file}`).toBeDefined();
46 return cg!
47 .getOutgoingEdges(src!.id)
48 .filter((e) => e.kind === kind)
49 .map((e) => cg!.getNode(e.target))
50 .map((n) => `${n!.name}@${n!.filePath.replace(/\\/g, '/')}`);
51 }
52
53 it('resolves an absolute dotted specifier to the module at a package root, not a same-named nested module', async () => {
54 write({

Callers 2

linkedFunction · 0.70

Calls 4

mapMethod · 0.80
getNodeMethod · 0.80
getNodesInFileMethod · 0.65
getOutgoingEdgesMethod · 0.45

Tested by

no test coverage detected