From 1173adb458f1fdac67ab343b6521b99dc5737707 Mon Sep 17 00:00:00 2001 From: Hunter Hogan Date: Tue, 29 Apr 2025 16:20:22 -0500 Subject: [PATCH 1/2] ast.pyi: consistent use of `# type: ignore[deprecated]` --- stdlib/ast.pyi | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/stdlib/ast.pyi b/stdlib/ast.pyi index 1a3d3e97d11e..59497af03a5d 100644 --- a/stdlib/ast.pyi +++ b/stdlib/ast.pyi @@ -1180,12 +1180,12 @@ class Slice(_Slice): ) -> Self: ... @deprecated("Deprecated since Python 3.9. Use ast.Tuple instead.") -class ExtSlice(slice): - def __new__(cls, dims: Iterable[slice] = (), **kwargs: Unpack[_SliceAttributes]) -> Tuple: ... # type: ignore[misc] +class ExtSlice(slice): # type: ignore[deprecated] + def __new__(cls, dims: Iterable[slice] = (), **kwargs: Unpack[_SliceAttributes]) -> Tuple: ... # type: ignore[deprecated] @deprecated("Deprecated since Python 3.9. Use the index value directly instead.") -class Index(slice): - def __new__(cls, value: expr, **kwargs: Unpack[_SliceAttributes]) -> expr: ... # type: ignore[misc] +class Index(slice): # type: ignore[deprecated] + def __new__(cls, value: expr, **kwargs: Unpack[_SliceAttributes]) -> expr: ... class expr_context(AST): ... @@ -2016,12 +2016,12 @@ class NodeVisitor: def visit_TypeAlias(self, node: TypeAlias) -> Any: ... # visit methods for deprecated nodes - def visit_ExtSlice(self, node: ExtSlice) -> Any: ... - def visit_Index(self, node: Index) -> Any: ... - def visit_Suite(self, node: Suite) -> Any: ... - def visit_AugLoad(self, node: AugLoad) -> Any: ... - def visit_AugStore(self, node: AugStore) -> Any: ... - def visit_Param(self, node: Param) -> Any: ... + def visit_ExtSlice(self, node: ExtSlice) -> Any: ... # type: ignore[deprecated] + def visit_Index(self, node: Index) -> Any: ... # type: ignore[deprecated] + def visit_Suite(self, node: Suite) -> Any: ... # type: ignore[deprecated] + def visit_AugLoad(self, node: AugLoad) -> Any: ... # type: ignore[deprecated] + def visit_AugStore(self, node: AugStore) -> Any: ... # type: ignore[deprecated] + def visit_Param(self, node: Param) -> Any: ... # type: ignore[deprecated] if sys.version_info < (3, 14): @deprecated("Replaced by visit_Constant; removed in Python 3.14") From 7d3a325480eced4c1328ffe7d05b846b823801a2 Mon Sep 17 00:00:00 2001 From: Hunter Hogan Date: Wed, 30 Apr 2025 07:02:19 -0500 Subject: [PATCH 2/2] ast.pyi: restore `# type: ignore[misc]` --- stdlib/ast.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/ast.pyi b/stdlib/ast.pyi index 59497af03a5d..374b3c4635f6 100644 --- a/stdlib/ast.pyi +++ b/stdlib/ast.pyi @@ -1181,11 +1181,11 @@ class Slice(_Slice): @deprecated("Deprecated since Python 3.9. Use ast.Tuple instead.") class ExtSlice(slice): # type: ignore[deprecated] - def __new__(cls, dims: Iterable[slice] = (), **kwargs: Unpack[_SliceAttributes]) -> Tuple: ... # type: ignore[deprecated] + def __new__(cls, dims: Iterable[slice] = (), **kwargs: Unpack[_SliceAttributes]) -> Tuple: ... # type: ignore[misc] @deprecated("Deprecated since Python 3.9. Use the index value directly instead.") class Index(slice): # type: ignore[deprecated] - def __new__(cls, value: expr, **kwargs: Unpack[_SliceAttributes]) -> expr: ... + def __new__(cls, value: expr, **kwargs: Unpack[_SliceAttributes]) -> expr: ... # type: ignore[misc] class expr_context(AST): ...