]> 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:

Clean up PEP 257 support
[etc/vim.git] / black.py
index 7dc6ef86c1d4b12a4a46bc2c1cd6fe080a12af01..dc67991f2c94d3f1444a56179409eb8c65cfbd9a 100644 (file)
--- a/black.py
+++ b/black.py
@@ -989,14 +989,11 @@ class Line:
 
     @property
     def is_triple_quoted_string(self) -> bool:
-        """Is the line a triple quoted docstring?"""
+        """Is the line a triple quoted string?"""
         return (
             bool(self)
             and self.leaves[0].type == token.STRING
-            and (
-                self.leaves[0].value.startswith('"""')
-                or self.leaves[0].value.startswith("'''")
-            )
+            and self.leaves[0].value.startswith(('"""', "'''"))
         )
 
     def contains_standalone_comments(self, depth_limit: int = sys.maxsize) -> bool:
@@ -1257,9 +1254,8 @@ class EmptyLineTracker:
             if self.previous_line.is_decorator:
                 return 0, 0
 
-            if (
-                self.previous_line.is_class
-                and self.previous_line.depth != current_line.depth
+            if self.previous_line.depth < current_line.depth and (
+                self.previous_line.is_class or self.previous_line.is_def
             ):
                 return 0, 0