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

Function _atom_has_magic_trailing_comma

src/black/linegen.py:1776–1785  ·  view source on GitHub ↗

Check if an atom node has a magic trailing comma. Returns True for single-element tuples with trailing commas like (a,), which should be preserved to maintain their tuple type.

(node: LN, mode: Mode)

Source from the content-addressed store, hash-verified

1774
1775
1776def _atom_has_magic_trailing_comma(node: LN, mode: Mode) -> bool:
1777 """Check if an atom node has a magic trailing comma.
1778
1779 Returns True for single-element tuples with trailing commas like (a,),
1780 which should be preserved to maintain their tuple type.
1781 """
1782 if not mode.magic_trailing_comma:
1783 return False
1784
1785 return is_one_tuple(node)
1786
1787
1788def _is_atom_multiline(node: LN) -> bool:

Callers 1

Calls 1

is_one_tupleFunction · 0.90

Tested by

no test coverage detected