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

Function edgesFrom

__tests__/python-builtin-names.test.ts:35–45  ·  view source on GitHub ↗

Every edge out of the nodes of `file`, but `contains`, as `kind target@file`.

(file: string)

Source from the content-addressed store, hash-verified

33
34/** Every edge out of the nodes of `file`, but `contains`, as `kind target@file`. */
35function edgesFrom(file: string): string[] {
36 return [...cg!.getNodesByKind('file'), ...cg!.getNodesByKind('function'), ...cg!.getNodesByKind('method'), ...cg!.getNodesByKind('class')]
37 .filter((n) => n.filePath === file)
38 .flatMap((n) => cg!.getOutgoingEdges(n.id))
39 .filter((e) => e.kind !== 'contains')
40 .map((e) => {
41 const t = cg!.getNode(e.target);
42 return `${e.kind} ${t?.qualifiedName}@${t?.filePath}`;
43 })
44 .sort();
45}
46
47const FAR = 'class TimeoutError(Exception):\n pass\n\n\nclass ValueError(Exception):\n pass\n\n\nclass KeyError(Exception):\n pass\n';
48

Callers 1

Calls 4

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

Tested by

no test coverage detected