Skip to content

Commit f8547a3

Browse files
authored
Use flake8-pyi 22.5.0, remove redundant parts of check_new_syntax (#7821)
1 parent fed1f35 commit f8547a3

File tree

2 files changed

+1
-25
lines changed

2 files changed

+1
-25
lines changed

requirements-tests.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pytype==2022.4.26; platform_system != "Windows"
44
black==22.3.0
55
flake8==4.0.1
66
flake8-bugbear==21.11.29
7-
flake8-pyi==22.4.1
7+
flake8-pyi==22.5.0
88
# must match .pre-commit-config.yaml
99
isort==5.10.1
1010
tomli==1.2.2

tests/check_new_syntax.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -71,26 +71,6 @@ def visit_ClassDef(self, node: ast.ClassDef) -> None:
7171
NonAnnotationUnionFinder().visit(base)
7272
self.generic_visit(node)
7373

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-
9474
class IfFinder(ast.NodeVisitor):
9575
def visit_If(self, node: ast.If) -> None:
9676
if (
@@ -106,10 +86,6 @@ def visit_If(self, node: ast.If) -> None:
10686
)
10787
self.generic_visit(node)
10888

109-
ObjectClassdefFinder().visit(tree)
110-
if path != Path("stdlib/typing_extensions.pyi"):
111-
TextFinder().visit(tree)
112-
11389
OldSyntaxFinder().visit(tree)
11490
IfFinder().visit(tree)
11591
return errors

0 commit comments

Comments
 (0)