Return True if `node` holds a tuple with one element, with or without parens.
(node: LN)
| 614 | |
| 615 | |
| 616 | def is_one_tuple(node: LN) -> bool: |
| 617 | """Return True if `node` holds a tuple with one element, with or without parens.""" |
| 618 | if node.type == syms.atom: |
| 619 | gexp = unwrap_singleton_parenthesis(node) |
| 620 | if gexp is None or gexp.type != syms.testlist_gexp: |
| 621 | return False |
| 622 | |
| 623 | return len(gexp.children) == 2 and gexp.children[1].type == token.COMMA |
| 624 | |
| 625 | return ( |
| 626 | node.type in IMPLICIT_TUPLE |
| 627 | and len(node.children) == 2 |
| 628 | and node.children[1].type == token.COMMA |
| 629 | ) |
| 630 | |
| 631 | |
| 632 | def is_tuple(node: LN) -> bool: |
no test coverage detected