Returns `wrapped` if `node` is of the shape ( wrapped ). Parenthesis can be optional. Returns None otherwise
(node: LN)
| 1006 | |
| 1007 | |
| 1008 | def unwrap_singleton_parenthesis(node: LN) -> LN | None: |
| 1009 | """Returns `wrapped` if `node` is of the shape ( wrapped ). |
| 1010 | |
| 1011 | Parenthesis can be optional. Returns None otherwise""" |
| 1012 | if len(node.children) != 3: |
| 1013 | return None |
| 1014 | |
| 1015 | lpar, wrapped, rpar = node.children |
| 1016 | if not (lpar.type == token.LPAR and rpar.type == token.RPAR): |
| 1017 | return None |
| 1018 | |
| 1019 | return wrapped |
| 1020 | |
| 1021 | |
| 1022 | def ensure_visible(leaf: Leaf) -> None: |
no outgoing calls
no test coverage detected