diff --git a/requirements-tests.txt b/requirements-tests.txt index 34393ba79..a7af02511 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -4,7 +4,7 @@ pytype==2022.4.26; platform_system != "Windows" black==22.3.0 flake8==4.0.1 flake8-bugbear==21.11.29 -flake8-pyi==22.4.1 +flake8-pyi==22.5.0 # must match .pre-commit-config.yaml isort==5.10.1 tomli==1.2.2 diff --git a/tests/check_new_syntax.py b/tests/check_new_syntax.py index 6ccff7c10..427db4ebd 100755 --- a/tests/check_new_syntax.py +++ b/tests/check_new_syntax.py @@ -71,26 +71,6 @@ def check_new_syntax(tree: ast.AST, path: Path, stub: str) -> list[str]: NonAnnotationUnionFinder().visit(base) self.generic_visit(node) - class ObjectClassdefFinder(ast.NodeVisitor): - def visit_ClassDef(self, node: ast.ClassDef) -> None: - if any(isinstance(base, ast.Name) and base.id == "object" for base in node.bases): - errors.append( - f"{path}:{node.lineno}: Do not inherit from `object` explicitly, " - f"as all classes implicitly inherit from `object` in Python 3" - ) - self.generic_visit(node) - - class TextFinder(ast.NodeVisitor): - def visit_ImportFrom(self, node: ast.ImportFrom) -> None: - if node.module == "typing" and any(thing.name == "Text" for thing in node.names): - errors.append(f"{path}:{node.lineno}: Use `str` instead of `typing.Text` in a Python-3-only stub.") - self.generic_visit(node) - - def visit_Attribute(self, node: ast.Attribute) -> None: - if isinstance(node.value, ast.Name) and node.value.id == "typing" and node.attr == "Text": - errors.append(f"{path}:{node.lineno}: Use `str` instead of `typing.Text` in a Python-3-only stub.") - self.generic_visit(node) - class IfFinder(ast.NodeVisitor): def visit_If(self, node: ast.If) -> None: if ( @@ -106,10 +86,6 @@ def check_new_syntax(tree: ast.AST, path: Path, stub: str) -> list[str]: ) self.generic_visit(node) - ObjectClassdefFinder().visit(tree) - if path != Path("stdlib/typing_extensions.pyi"): - TextFinder().visit(tree) - OldSyntaxFinder().visit(tree) IfFinder().visit(tree) return errors