]> git.madduck.net Git - etc/vim.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Don't leave invalid trailing comma on imports
authorŁukasz Langa <lukasz@langa.pl>
Mon, 7 May 2018 17:34:30 +0000 (10:34 -0700)
committerŁukasz Langa <lukasz@langa.pl>
Mon, 7 May 2018 17:40:18 +0000 (10:40 -0700)
Fixes #185

black.py
tests/import_spacing.py

index 46754566fd4aaac239b93c0250fd9c12da2c9d39..fd2b75ed2c1cf9d5ffb3759f142b6855b0a23b9e 100644 (file)
--- a/black.py
+++ b/black.py
@@ -885,9 +885,14 @@ class Line:
                 self.remove_trailing_comma()
                 return True
 
                 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
         depth = closing.bracket_depth + 1
         commas = 0
         opening = closing.opening_bracket
index f095ba13371a245597f3631db471021b41a0a3fe..cc17405aa3a6486b3c05e1985fc808a1ab41e76f 100644 (file)
@@ -2,6 +2,9 @@
 
 # flake8: noqa
 
 
 # flake8: noqa
 
+from logging import (
+    ERROR,
+)
 import sys
 
 # This relies on each of the submodules having an __all__ variable.
 import sys
 
 # This relies on each of the submodules having an __all__ variable.
@@ -48,6 +51,7 @@ __all__ = (
 
 # flake8: noqa
 
 
 # flake8: noqa
 
+from logging import ERROR
 import sys
 
 # This relies on each of the submodules having an __all__ variable.
 import sys
 
 # This relies on each of the submodules having an __all__ variable.