Skip to content

Commit 5465c96

Browse files
tochilinakzishkaz
authored andcommitted
Extract isAbstract for concrete types from mypy
1 parent 0c042a7 commit 5465c96

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

utbot-python/src/main/resources/mypy/extract_annotations.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def __init__(self, type_name: str, symbol_node: mypy.nodes.TypeInfo, id_, namesp
137137
self.type_vars: tp.List[Annotation] = [
138138
get_annotation(x, self.namespace) for x in self.raw_type_vars
139139
]
140-
self.bases = [get_annotation(x, self.namespace) for x in symbol_node.bases]
140+
self.bases: tp.List[Annotation] = [get_annotation(x, self.namespace) for x in symbol_node.bases]
141141

142142
def encode(self):
143143
superclass_dict = super().encode()
@@ -157,10 +157,13 @@ class ConcreteAnnotationNode(CompositeAnnotationNode):
157157
def __init__(self, symbol_node: mypy.nodes.TypeInfo, id_, namespace: Meta):
158158
assert not symbol_node.is_protocol
159159
super().__init__("Concrete", symbol_node, id_, namespace)
160+
self.is_abstract: bool = symbol_node.is_abstract
160161

161162
def encode(self):
162-
return super().encode()
163-
163+
superclass_dict = super().encode()
164+
subclass_dict = {"isAbstract": self.is_abstract}
165+
return dict(superclass_dict, **subclass_dict)
166+
164167

165168
class ProtocolAnnotationNode(CompositeAnnotationNode):
166169
def __init__(self, symbol_node: mypy.nodes.TypeInfo, id_, namespace: Meta):

0 commit comments

Comments
 (0)