X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/0c5c5374313566dd9047c3e992a3c23a7ea4b8f2..1610fd6bc5d594c4f27698825913d2f791d3ea02:/black.py diff --git a/black.py b/black.py index 84ae9f1..2eefe11 100644 --- a/black.py +++ b/black.py @@ -2329,8 +2329,9 @@ def bracket_split_build_line( # Since body is a new indent level, remove spurious leading whitespace. normalize_prefix(leaves[0], inside_brackets=True) # Ensure a trailing comma when expected. - if original.is_import and len(leaves) == 1: - leaves.append(Leaf(token.COMMA, ",")) + if original.is_import: + if leaves[-1].type != token.COMMA: + leaves.append(Leaf(token.COMMA, ",")) # Populate the line for leaf in leaves: result.append(leaf, preformatted=True)