Use @deprecated for those visit methods of class NodeVisitor that deal with classes that have already been marked with @deprecated and add type: ignore[deprecated] comments. (#12864)

This commit is contained in:
Christoph Tyralla
2024-10-21 13:44:57 +02:00
committed by GitHub
parent b0ac25e7bd
commit 8d02c2a6df

View File

@@ -2023,11 +2023,19 @@ class NodeVisitor:
def visit_AugLoad(self, node: AugLoad) -> Any: ...
def visit_AugStore(self, node: AugStore) -> Any: ...
def visit_Param(self, node: Param) -> Any: ...
def visit_Num(self, node: Num) -> Any: ...
def visit_Str(self, node: Str) -> Any: ...
def visit_Bytes(self, node: Bytes) -> Any: ...
def visit_NameConstant(self, node: NameConstant) -> Any: ...
def visit_Ellipsis(self, node: Ellipsis) -> Any: ...
if sys.version_info < (3, 14):
@deprecated("Replaced by visit_Constant; removed in Python 3.14")
def visit_Num(self, node: Num) -> Any: ... # type: ignore[deprecated]
@deprecated("Replaced by visit_Constant; removed in Python 3.14")
def visit_Str(self, node: Str) -> Any: ... # type: ignore[deprecated]
@deprecated("Replaced by visit_Constant; removed in Python 3.14")
def visit_Bytes(self, node: Bytes) -> Any: ... # type: ignore[deprecated]
@deprecated("Replaced by visit_Constant; removed in Python 3.14")
def visit_NameConstant(self, node: NameConstant) -> Any: ... # type: ignore[deprecated]
@deprecated("Replaced by visit_Constant; removed in Python 3.14")
def visit_Ellipsis(self, node: Ellipsis) -> Any: ... # type: ignore[deprecated]
class NodeTransformer(NodeVisitor):
def generic_visit(self, node: AST) -> AST: ...