From 154452ffc2951d2f3326fcc90fcec604de246f52 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Tue, 27 Dec 2022 04:27:44 +0000 Subject: [PATCH] `ast.NodeVisitor`: Add `visit_*` methods for `ast` nodes new in 3.8-3.10 (#9413) --- stdlib/ast.pyi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/stdlib/ast.pyi b/stdlib/ast.pyi index 1c2d8a597..b7fab39a0 100644 --- a/stdlib/ast.pyi +++ b/stdlib/ast.pyi @@ -89,6 +89,7 @@ class NodeVisitor: def visit_Constant(self, node: Constant) -> Any: ... if sys.version_info >= (3, 8): def visit_NamedExpr(self, node: NamedExpr) -> Any: ... + def visit_TypeIgnore(self, node: TypeIgnore) -> Any: ... def visit_Attribute(self, node: Attribute) -> Any: ... def visit_Subscript(self, node: Subscript) -> Any: ... @@ -135,6 +136,16 @@ class NodeVisitor: def visit_keyword(self, node: keyword) -> Any: ... def visit_alias(self, node: alias) -> Any: ... def visit_withitem(self, node: withitem) -> Any: ... + if sys.version_info >= (3, 10): + def visit_Match(self, node: Match) -> Any: ... + def visit_MatchValue(self, node: MatchValue) -> Any: ... + def visit_MatchSequence(self, node: MatchSequence) -> Any: ... + def visit_MatchStar(self, node: MatchStar) -> Any: ... + def visit_MatchMapping(self, node: MatchMapping) -> Any: ... + def visit_MatchClass(self, node: MatchClass) -> Any: ... + def visit_MatchAs(self, node: MatchAs) -> Any: ... + def visit_MatchOr(self, node: MatchOr) -> Any: ... + # visit methods for deprecated nodes def visit_ExtSlice(self, node: ExtSlice) -> Any: ... def visit_Index(self, node: Index) -> Any: ...