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

Function right_hand_split

src/black/linegen.py:941–958  ·  view source on GitHub ↗

Split line into many lines, starting with the last matching bracket pair. If the split was by optional parentheses, attempt splitting without them, too. `omit` is a collection of closing bracket IDs that shouldn't be considered for this split. Note: running this function modifies `

(
    line: Line,
    mode: Mode,
    features: Collection[Feature] = (),
    omit: Collection[LeafID] = (),
)

Source from the content-addressed store, hash-verified

939
940
941def right_hand_split(
942 line: Line,
943 mode: Mode,
944 features: Collection[Feature] = (),
945 omit: Collection[LeafID] = (),
946) -> Iterator[Line]:
947 """Split line into many lines, starting with the last matching bracket pair.
948
949 If the split was by optional parentheses, attempt splitting without them, too.
950 `omit` is a collection of closing bracket IDs that shouldn't be considered for
951 this split.
952
953 Note: running this function modifies `bracket_depth` on the leaves of `line`.
954 """
955 rhs_result = _first_right_hand_split(line, omit=omit)
956 yield from _maybe_split_omitting_optional_parens(
957 rhs_result, line, mode, features=features, omit=omit
958 )
959
960
961def _first_right_hand_split(

Callers 1

_rhsFunction · 0.85

Tested by

no test coverage detected