From b9c06a0d23b7d422d1c8dc1727d6fe15757a4716 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Langa?= Date: Fri, 16 Mar 2018 22:14:43 -0700 Subject: [PATCH 1/1] Don't put four empty lines between top-level functions split by a comment --- README.md | 3 +++ black.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/README.md b/README.md index 61498b2..0ccef30 100644 --- a/README.md +++ b/README.md @@ -269,6 +269,9 @@ More details can be found in [CONTRIBUTING](CONTRIBUTING.md). * remove a trailing comma if there is a single argument to a call +* if top level functions were separated by a comment, don't put four + empty lines after the upper function + * fixed missing space in numpy-style array indexing (#33) * fixed spurious space after star-based unary expressions (#31) diff --git a/black.py b/black.py index 10346a9..0fe8fef 100644 --- a/black.py +++ b/black.py @@ -628,6 +628,10 @@ class EmptyLineTracker: (two on module-level), as well as providing an extra empty line after flow control keywords to make them more prominent. """ + if current_line.is_comment: + # Don't count standalone comments towards previous empty lines. + return 0, 0 + before, after = self._maybe_empty_lines(current_line) self.previous_after = after self.previous_line = current_line -- 2.39.5