]> git.madduck.net Git - etc/vim.git/blobdiff - black.py

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:

Allow up to two empty lines on module level and single empty lines otherwise
[etc/vim.git] / black.py
index 9ea46944b1e042260b57db4382cb6cfd0826f6ab..da7af03aebf3f5511a93f12c61283c6603541c03 100644 (file)
--- a/black.py
+++ b/black.py
@@ -754,13 +754,13 @@ class EmptyLineTracker:
 
     def _maybe_empty_lines(self, current_line: Line) -> Tuple[int, int]:
         max_allowed = 1
-        if current_line.is_comment and current_line.depth == 0:
+        if current_line.depth == 0:
             max_allowed = 2
         if current_line.leaves:
             # Consume the first leaf's extra newlines.
             first_leaf = current_line.leaves[0]
             before = first_leaf.prefix.count('\n')
-            before = min(before, max(before, max_allowed))
+            before = min(before, max_allowed)
             first_leaf.prefix = ''
         else:
             before = 0