From 447741e50d982cac610551b1e322109213c24087 Mon Sep 17 00:00:00 2001 From: Yilei Yang Date: Tue, 14 Nov 2023 16:16:59 -0800 Subject: [PATCH] Cherry pick https://github.com/psf/black/pull/4028. This keeps two blank lines between the module docstring and the following def/class when there are no other code in between. Why cherrypick not rebase? Pyink is not yet ready to rebase to Black 23.11.0 yet, I'm waiting for https://github.com/psf/black/pull/4012 to be merged as Pyink has local patches related by hugging parens. PiperOrigin-RevId: 582472645 --- src/pyink/lines.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pyink/lines.py b/src/pyink/lines.py index 1e2d6457539..99948615e3c 100644 --- a/src/pyink/lines.py +++ b/src/pyink/lines.py @@ -595,6 +595,7 @@ def maybe_empty_lines(self, current_line: Line) -> LinesBlock: and self.previous_block.previous_block is None and len(self.previous_block.original_line.leaves) == 1 and self.previous_block.original_line.is_triple_quoted_string + and not (current_line.is_class or current_line.is_def) ): before = 1