forked from colbymchenry/codegraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_python_inheritance.js
More file actions
35 lines (27 loc) · 829 Bytes
/
test_python_inheritance.js
File metadata and controls
35 lines (27 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const { extractFromSource } = require('./dist/extraction');
const { initGrammars, loadAllGrammars } = require('./dist/extraction/grammars');
(async () => {
await initGrammars();
await loadAllGrammars();
const code = `
class Parent:
pass
class Child(Parent):
pass
class Multiple(Parent, Mixin):
pass
`;
const result = extractFromSource('test.py', code);
console.log('=== NODES ===');
result.nodes.forEach(n => {
console.log(`${n.kind}: ${n.name} (line ${n.startLine})`);
});
console.log('\n=== UNRESOLVED REFERENCES ===');
result.unresolvedReferences.forEach(r => {
console.log(`${r.referenceKind}: ${r.referenceName} (from ${r.fromNodeId})`);
});
console.log('\n=== EDGES ===');
result.edges.forEach(e => {
console.log(`${e.kind}: ${e.source} -> ${e.target}`);
});
})();