feat: Add Python class inheritance extraction for superclass relationships

Addresses Python's class definition syntax where parent classes are specified in argument_list nodes (e.g. `class Child(Parent, Mixin):`). Extracts identifier and attribute children from argument_list as 'extends' references to properly model Python's inheritance patterns in the code graph.
This commit is contained in:
Colby McHenry
2026-04-06 20:13:25 -05:00
parent 392c146810
commit a0f599e00b
4 changed files with 104 additions and 0 deletions
+17
View File
@@ -1241,6 +1241,23 @@ export class TreeSitterExtractor {
}
}
// Python superclass list: `class Flask(Scaffold, Mixin):`
// argument_list contains identifier children for each parent class
if (child.type === 'argument_list' && node.type === 'class_definition') {
for (const arg of child.namedChildren) {
if (arg.type === 'identifier' || arg.type === 'attribute') {
const name = getNodeText(arg, this.source);
this.unresolvedReferences.push({
fromNodeId: classId,
referenceName: name,
referenceKind: 'extends',
line: arg.startPosition.row + 1,
column: arg.startPosition.column,
});
}
}
}
// Go interface embedding: `type Querier interface { LabelQuerier; ... }`
// constraint_elem wraps the embedded interface type identifier
if (child.type === 'constraint_elem') {