MCPcopy
hub / github.com/psf/black / is_tuple_containing_walrus

Function is_tuple_containing_walrus

src/black/nodes.py:643–651  ·  view source on GitHub ↗

Return True if `node` holds a tuple that contains a walrus operator.

(node: LN)

Source from the content-addressed store, hash-verified

641
642
643def is_tuple_containing_walrus(node: LN) -> bool:
644 """Return True if `node` holds a tuple that contains a walrus operator."""
645 if node.type != syms.atom:
646 return False
647 gexp = unwrap_singleton_parenthesis(node)
648 if gexp is None or gexp.type != syms.testlist_gexp:
649 return False
650
651 return any(child.type == syms.namedexpr_test for child in gexp.children)
652
653
654def is_tuple_containing_star(node: LN) -> bool:

Callers 1

Calls 1

Tested by

no test coverage detected