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

Function pythonEdges

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

Every Python calls/imports edge, as a sorted list of readable triples.

(graph: CodeGraph)

Source from the content-addressed store, hash-verified

1090 describe('sync', () => {
1091 /** Every Python calls/imports edge, as a sorted list of readable triples. */
1092 function pythonEdges(graph: CodeGraph): string[] {
1093 const out: string[] = [];
1094 for (const n of graph.getNodesByKind('function').concat(graph.getNodesByKind('file'))) {
1095 if (!n.filePath.endsWith('.py')) continue;
1096 for (const e of graph.getOutgoingEdges(n.id)) {
1097 if (e.kind !== 'calls' && e.kind !== 'imports') continue;
1098 const t = graph.getNode(e.target)!;
1099 out.push(`${e.kind} ${n.name}@${n.filePath} -> ${t.kind}:${t.name}@${t.filePath}`);
1100 }
1101 }
1102 return out.sort();
1103 }
1104
1105 async function freshEdges(): Promise<string[]> {
1106 const copy = fs.mkdtempSync(path.join(os.tmpdir(), 'codegraph-pymod-fresh-'));

Callers 3

freshEdgesFunction · 0.85
editAndCompareFunction · 0.85

Calls 4

getNodeMethod · 0.80
pushMethod · 0.80
getNodesByKindMethod · 0.65
getOutgoingEdgesMethod · 0.45

Tested by

no test coverage detected