Every Python calls/imports edge, as a sorted list of readable triples.
(graph: CodeGraph)
| 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-')); |
no test coverage detected