Drop support for Python 3.7 (#11234)

This commit is contained in:
Sebastian Rittau
2024-01-04 14:48:44 +01:00
committed by GitHub
parent 262d73c90c
commit 4e5f7a7142
10 changed files with 8 additions and 48 deletions

View File

@@ -26,29 +26,7 @@ def check_new_syntax(tree: ast.AST, path: Path, stub: str) -> list[str]:
)
self.generic_visit(node)
class PEP570Finder(ast.NodeVisitor):
def __init__(self) -> None:
self.lineno: int | None = None
def _visit_function(self, node: ast.FunctionDef | ast.AsyncFunctionDef) -> None:
old_lineno = self.lineno
self.lineno = node.lineno
self.generic_visit(node)
self.lineno = old_lineno
visit_FunctionDef = visit_AsyncFunctionDef = _visit_function
def visit_arguments(self, node: ast.arguments) -> None:
if node.posonlyargs:
assert isinstance(self.lineno, int)
errors.append(
f"{path}:{self.lineno}: PEP-570 syntax cannot be used in typeshed yet. "
f"Prefix parameter names with `__` to indicate positional-only parameters"
)
self.generic_visit(node)
IfFinder().visit(tree)
PEP570Finder().visit(tree)
return errors

View File

@@ -41,7 +41,7 @@ VENV_DIR = ".venv"
TYPESHED = "typeshed"
SUPPORTED_PLATFORMS = ["linux", "darwin", "win32"]
SUPPORTED_VERSIONS = ["3.12", "3.11", "3.10", "3.9", "3.8", "3.7"]
SUPPORTED_VERSIONS = ["3.12", "3.11", "3.10", "3.9", "3.8"]
def package_with_test_cases(package_name: str) -> PackageInfo: