We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1ad4f76 commit c85fe85Copy full SHA for c85fe85
mypy/semanal.py
@@ -1196,14 +1196,13 @@ def analyze_class(self, defn: ClassDef) -> None:
1196
1197
# should this be memoized in TypeInfo?
1198
def find_maximum_class_id(self, info: TypeInfo) -> int:
1199
- # top class?
1200
- if len(info.mro) in (0, 1):
1201
- return len(info.type_vars)
1202
- else:
+ if info.bases:
1203
return len(info.type_vars) + max(
1204
- self.find_maximum_class_id(cls)
1205
- for cls in info.mro[1:]
+ self.find_maximum_class_id(cls.type)
+ for cls in info.bases
1206
)
+ else:
+ return len(info.type_vars)
1207
1208
def is_core_builtin_class(self, defn: ClassDef) -> bool:
1209
return self.cur_mod_id == 'builtins' and defn.name in CORE_BUILTIN_CLASSES
0 commit comments