@@ -900,13 +900,7 @@ def visit_class_def(self, o: ClassDef) -> None:
900
900
if isinstance (o .metaclass , (NameExpr , MemberExpr )):
901
901
meta = o .metaclass .accept (AliasPrinter (self ))
902
902
base_types .append ("metaclass=" + meta )
903
- elif self .analyzed and o .info .is_protocol :
904
- type_str = "Protocol"
905
- if o .info .type_vars :
906
- type_str += f'[{ ", " .join (o .info .type_vars )} ]'
907
- base_types .append (type_str )
908
- self .add_typing_import ("Protocol" )
909
- elif self .analyzed and o .info .is_abstract :
903
+ elif self .analyzed and o .info .is_abstract and not o .info .is_protocol :
910
904
base_types .append ("metaclass=abc.ABCMeta" )
911
905
self .import_tracker .add_import ("abc" )
912
906
self .import_tracker .require_name ("abc" )
@@ -933,7 +927,7 @@ def get_base_types(self, cdef: ClassDef) -> list[str]:
933
927
"""Get list of base classes for a class."""
934
928
base_types : list [str ] = []
935
929
p = AliasPrinter (self )
936
- for base in cdef .base_type_exprs :
930
+ for base in cdef .base_type_exprs + cdef . removed_base_type_exprs :
937
931
if isinstance (base , (NameExpr , MemberExpr )):
938
932
if self .get_fullname (base ) != "builtins.object" :
939
933
base_types .append (get_qualified_name (base ))
0 commit comments