From ccb44379f04eacbf9519427c84ecce8977b2e2f7 Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Sat, 15 Jan 2022 10:52:15 -0500 Subject: [PATCH] Fix typing of get_node_first_ancestor_type() and related method --- pylint/checkers/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py index 65c7e3102f..7e08a9048a 100644 --- a/pylint/checkers/utils.py +++ b/pylint/checkers/utils.py @@ -1715,7 +1715,7 @@ def returns_bool(node: nodes.NodeNG) -> bool: def get_node_first_ancestor_of_type( - node: nodes.NodeNG, ancestor_type: Union[Type[T_Node], Tuple[Type[T_Node]]] + node: nodes.NodeNG, ancestor_type: Union[Type[T_Node], Tuple[Type[T_Node], ...]] ) -> Optional[T_Node]: """Return the first parent node that is any of the provided types (or None)""" for ancestor in node.node_ancestors(): @@ -1725,7 +1725,7 @@ def get_node_first_ancestor_of_type( def get_node_first_ancestor_of_type_and_its_child( - node: nodes.NodeNG, ancestor_type: Union[Type[T_Node], Tuple[Type[T_Node]]] + node: nodes.NodeNG, ancestor_type: Union[Type[T_Node], Tuple[Type[T_Node], ...]] ) -> Union[Tuple[None, None], Tuple[T_Node, nodes.NodeNG]]: """Modified version of get_node_first_ancestor_of_type to also return the descendant visited directly before reaching the sought ancestor. Useful