@@ -71,26 +71,6 @@ def visit_ClassDef(self, node: ast.ClassDef) -> None:
71
71
NonAnnotationUnionFinder ().visit (base )
72
72
self .generic_visit (node )
73
73
74
- class ObjectClassdefFinder (ast .NodeVisitor ):
75
- def visit_ClassDef (self , node : ast .ClassDef ) -> None :
76
- if any (isinstance (base , ast .Name ) and base .id == "object" for base in node .bases ):
77
- errors .append (
78
- f"{ path } :{ node .lineno } : Do not inherit from `object` explicitly, "
79
- f"as all classes implicitly inherit from `object` in Python 3"
80
- )
81
- self .generic_visit (node )
82
-
83
- class TextFinder (ast .NodeVisitor ):
84
- def visit_ImportFrom (self , node : ast .ImportFrom ) -> None :
85
- if node .module == "typing" and any (thing .name == "Text" for thing in node .names ):
86
- errors .append (f"{ path } :{ node .lineno } : Use `str` instead of `typing.Text` in a Python-3-only stub." )
87
- self .generic_visit (node )
88
-
89
- def visit_Attribute (self , node : ast .Attribute ) -> None :
90
- if isinstance (node .value , ast .Name ) and node .value .id == "typing" and node .attr == "Text" :
91
- errors .append (f"{ path } :{ node .lineno } : Use `str` instead of `typing.Text` in a Python-3-only stub." )
92
- self .generic_visit (node )
93
-
94
74
class IfFinder (ast .NodeVisitor ):
95
75
def visit_If (self , node : ast .If ) -> None :
96
76
if (
@@ -106,10 +86,6 @@ def visit_If(self, node: ast.If) -> None:
106
86
)
107
87
self .generic_visit (node )
108
88
109
- ObjectClassdefFinder ().visit (tree )
110
- if path != Path ("stdlib/typing_extensions.pyi" ):
111
- TextFinder ().visit (tree )
112
-
113
89
OldSyntaxFinder ().visit (tree )
114
90
IfFinder ().visit (tree )
115
91
return errors
0 commit comments