Return True if `leaf` is a star or double star in a vararg or kwarg. If `within` includes VARARGS_PARENTS, this applies to function signatures. If `within` includes UNPACKING_PARENTS, it applies to right hand-side extended iterable unpacking (PEP 3132) and additional unpacking gener
(leaf: Leaf, within: set[NodeType])
| 788 | |
| 789 | |
| 790 | def is_vararg(leaf: Leaf, within: set[NodeType]) -> bool: |
| 791 | """Return True if `leaf` is a star or double star in a vararg or kwarg. |
| 792 | |
| 793 | If `within` includes VARARGS_PARENTS, this applies to function signatures. |
| 794 | If `within` includes UNPACKING_PARENTS, it applies to right hand-side |
| 795 | extended iterable unpacking (PEP 3132) and additional unpacking |
| 796 | generalizations (PEP 448). |
| 797 | """ |
| 798 | if leaf.type not in VARARGS_SPECIALS or not leaf.parent: |
| 799 | return False |
| 800 | |
| 801 | p = leaf.parent |
| 802 | if p.type == syms.star_expr: |
| 803 | # Star expressions are also used as assignment targets in extended |
| 804 | # iterable unpacking (PEP 3132). See what its parent is instead. |
| 805 | if not p.parent: |
| 806 | return False |
| 807 | |
| 808 | p = p.parent |
| 809 | |
| 810 | return p.type in within |
| 811 | |
| 812 | |
| 813 | def is_fstring(node: Node) -> bool: |
no outgoing calls
no test coverage detected