X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/5f9eb9e4f7baa35cb87eb3f8a9fed81f1195a72e..25d24a10a4f4cdf81b7335615c74f285127b1a04:/black.py diff --git a/black.py b/black.py index 5676531..f76f0ff 100644 --- a/black.py +++ b/black.py @@ -2209,7 +2209,7 @@ def left_hand_split(line: Line, py36: bool = False) -> Iterator[Line]: yield result -def right_hand_split( +def right_hand_split( # noqa C901 line: Line, line_length: int, py36: bool = False, omit: Collection[LeafID] = () ) -> Iterator[Line]: """Split line into many lines, starting with the last matching bracket pair. @@ -2250,6 +2250,9 @@ def right_hand_split( # the matching `opening_bracket` wasn't available on `line` anymore. raise CannotSplit("No brackets found") + if line.is_import and len(body_leaves) == 1: + body_leaves.append(Leaf(token.COMMA, ",")) + # Build the new lines. for result, leaves in (head, head_leaves), (body, body_leaves), (tail, tail_leaves): for leaf in leaves: