diff options
Diffstat (limited to 'pylint/checkers/utils.py')
-rw-r--r-- | pylint/checkers/utils.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py index 98e7cbfe3..95778dbad 100644 --- a/pylint/checkers/utils.py +++ b/pylint/checkers/utils.py @@ -2030,6 +2030,20 @@ def find_assigned_names_recursive( yield from find_assigned_names_recursive(elt) +def has_starred_node_recursive( + node: nodes.For | nodes.Comprehension | nodes.Set, +) -> Iterator[bool]: + """Yield ``True`` if a Starred node is found recursively.""" + if isinstance(node, nodes.Starred): + yield True + elif isinstance(node, nodes.Set): + for elt in node.elts: + yield from has_starred_node_recursive(elt) + elif isinstance(node, (nodes.For, nodes.Comprehension)): + for elt in node.iter.elts: + yield from has_starred_node_recursive(elt) + + def is_hashable(node: nodes.NodeNG) -> bool: """Return whether any inferred value of `node` is hashable. |