update comments

This commit is contained in:
Jelle Zijlstra 2023-11-20 21:11:44 -08:00
parent d753703005
commit 129349ce66

View File

@ -684,14 +684,17 @@ def _maybe_empty_lines(self, current_line: Line) -> Tuple[int, int]:
return 0, 1 return 0, 1
return before, 1 return before, 1
is_empty_first_line_ok = Preview.allow_empty_first_line_in_block in current_line.mode and ( # In preview mode, always allow blank lines, except right before a function docstring
not is_docstring(current_line.leaves[0]) is_empty_first_line_ok = (
# If it's a triple quote comment (but not at the start of a funcdef) Preview.allow_empty_first_line_in_block in current_line.mode
or ( and (
self.previous_line not is_docstring(current_line.leaves[0])
and self.previous_line.leaves[0] or (
and self.previous_line.leaves[0].parent self.previous_line
and not is_funcdef(self.previous_line.leaves[0].parent) and self.previous_line.leaves[0]
and self.previous_line.leaves[0].parent
and not is_funcdef(self.previous_line.leaves[0].parent)
)
) )
) )