@@ -1152,7 +1152,10 @@ def analyze_class(self, defn: ClassDef) -> None:
1152
1152
# update the typevar ids such that they will not conflict with any base classes
1153
1153
# (yuck, there has to be a better way to do this.)
1154
1154
if any (isinstance (base [0 ], Instance ) for base in base_types ):
1155
- offset = max (self .find_maximum_class_id (base [0 ].type ) for base in base_types if isinstance (base [0 ], Instance ))
1155
+ offset = max (
1156
+ self .find_maximum_class_id (base [0 ].type )
1157
+ for base in base_types if isinstance (base [0 ], Instance )
1158
+ )
1156
1159
# mutating the type vars to be what we want (and hoping nothing previously saved them)
1157
1160
for tvar in tvar_defs :
1158
1161
tvar .id .raw_id += offset
@@ -1191,13 +1194,16 @@ def analyze_class(self, defn: ClassDef) -> None:
1191
1194
self .analyze_class_decorator (defn , decorator )
1192
1195
self .analyze_class_body_common (defn )
1193
1196
1194
- # should this be memoized in TypeInfo??
1197
+ # should this be memoized in TypeInfo?
1195
1198
def find_maximum_class_id (self , info : TypeInfo ) -> int :
1196
1199
# top class?
1197
1200
if len (info .mro ) in (0 , 1 ):
1198
1201
return len (info .type_vars )
1199
1202
else :
1200
- return len (info .type_vars ) + max (self .find_maximum_class_id (cls ) for cls in info .mro [1 :])
1203
+ return len (info .type_vars ) + max (
1204
+ self .find_maximum_class_id (cls )
1205
+ for cls in info .mro [1 :]
1206
+ )
1201
1207
1202
1208
def is_core_builtin_class (self , defn : ClassDef ) -> bool :
1203
1209
return self .cur_mod_id == 'builtins' and defn .name in CORE_BUILTIN_CLASSES
0 commit comments