Add explode_split
to documentation
This commit is contained in:
parent
1445bea97e
commit
b62bd4de75
3
black.py
3
black.py
@ -1984,13 +1984,14 @@ def append_to_line(leaf: Leaf) -> Iterator[Line]:
|
|||||||
def explode_split(
|
def explode_split(
|
||||||
line: Line, py36: bool = False, omit: Collection[LeafID] = ()
|
line: Line, py36: bool = False, omit: Collection[LeafID] = ()
|
||||||
) -> Iterator[Line]:
|
) -> Iterator[Line]:
|
||||||
"""Split by RHS and immediately split contents by a delimiter."""
|
"""Split by rightmost bracket and immediately split contents by a delimiter."""
|
||||||
new_lines = list(right_hand_split(line, py36, omit))
|
new_lines = list(right_hand_split(line, py36, omit))
|
||||||
if len(new_lines) != 3:
|
if len(new_lines) != 3:
|
||||||
yield from new_lines
|
yield from new_lines
|
||||||
return
|
return
|
||||||
|
|
||||||
yield new_lines[0]
|
yield new_lines[0]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
yield from delimiter_split(new_lines[1], py36)
|
yield from delimiter_split(new_lines[1], py36)
|
||||||
except CannotSplit:
|
except CannotSplit:
|
||||||
|
@ -60,6 +60,8 @@ Split functions
|
|||||||
|
|
||||||
.. autofunction:: black.delimiter_split
|
.. autofunction:: black.delimiter_split
|
||||||
|
|
||||||
|
.. autofunction:: black.explode_split
|
||||||
|
|
||||||
.. autofunction:: black.left_hand_split
|
.. autofunction:: black.left_hand_split
|
||||||
|
|
||||||
.. autofunction:: black.right_hand_split
|
.. autofunction:: black.right_hand_split
|
||||||
|
Loading…
Reference in New Issue
Block a user