X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/b1cd59f26776faf543078ee2fdbf2b01fa5ed15e..dc0c14240e7423d9ada002835dcc195f8c6d8797:/black.py diff --git a/black.py b/black.py index 4675456..fd2b75e 100644 --- a/black.py +++ b/black.py @@ -885,9 +885,14 @@ class Line: self.remove_trailing_comma() return True - # For parens let's check if it's safe to remove the comma. If the - # trailing one is the only one, we might mistakenly change a tuple - # into a different type by removing the comma. + # For parens let's check if it's safe to remove the comma. + # Imports are always safe. + if self.is_import: + self.remove_trailing_comma() + return True + + # Otheriwsse, if the trailing one is the only one, we might mistakenly + # change a tuple into a different type by removing the comma. depth = closing.bracket_depth + 1 commas = 0 opening = closing.opening_bracket