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

Function linksFrom

__tests__/python-function-value-shadowed-import.test.ts:203–213  ·  view source on GitHub ↗

What the symbol with this qualified name in `file` calls or references, as `kind name@file`.

(file: string, qualified: string)

Source from the content-addressed store, hash-verified

201
202/** What the symbol with this qualified name in `file` calls or references, as `kind name@file`. */
203function linksFrom(file: string, qualified: string): string[] {
204 const from = cg.getNodesInFile(file).filter((n) => n.qualifiedName === qualified && n.kind !== 'import');
205 expect(from.length, `${qualified} should be indexed once in ${file}`).toBe(1);
206 return cg
207 .getOutgoingEdges(from[0]!.id)
208 .filter((e) => e.kind === 'calls' || e.kind === 'references')
209 .map((e) => ({ e, n: cg.getNode(e.target) }))
210 .filter((x): x is { e: typeof x.e; n: NonNullable<typeof x.n> } => !!x.n)
211 .map(({ e, n }) => `${e.kind} ${n.qualifiedName}@${n.filePath}`)
212 .sort();
213}
214
215const PROMPT = 'prompt@pkg/termui.py';
216const CONFIRM = 'confirm@pkg/termui.py';

Calls 4

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

Tested by

no test coverage detected