X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/ecc1f17ee57fd1d6c29e47194b1025721f99455b..c0a8e4224360a6917dcb5d889b08d5fdcfaf7c2d:/src/black/__init__.py?ds=sidebyside diff --git a/src/black/__init__.py b/src/black/__init__.py index bfb7712..9e18a7d 100644 --- a/src/black/__init__.py +++ b/src/black/__init__.py @@ -1834,6 +1834,10 @@ class EmptyLineTracker: return 0, 0 if self.previous_line.is_decorator: + if self.is_pyi and current_line.is_stub_class: + # Insert an empty line after a decorated stub class + return 0, 1 + return 0, 0 if self.previous_line.depth < current_line.depth and ( @@ -1857,8 +1861,11 @@ class EmptyLineTracker: newlines = 0 else: newlines = 1 - elif current_line.is_def and not self.previous_line.is_def: - # Blank line between a block of functions and a block of non-functions + elif ( + current_line.is_def or current_line.is_decorator + ) and not self.previous_line.is_def: + # Blank line between a block of functions (maybe with preceding + # decorators) and a block of non-functions newlines = 1 else: newlines = 0