X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/b7717c3f1e73d6b847e2534a2cebbb657b96caf8..bb588073ab286a9f1f8d839ab2cebe13011dd22c:/src/black/lines.py?ds=inline diff --git a/src/black/lines.py b/src/black/lines.py index 14754d7..48fde88 100644 --- a/src/black/lines.py +++ b/src/black/lines.py @@ -193,11 +193,16 @@ class Line: @property def is_triple_quoted_string(self) -> bool: """Is the line a triple quoted string?""" - return ( - bool(self) - and self.leaves[0].type == token.STRING - and self.leaves[0].value.startswith(('"""', "'''")) - ) + if not self or self.leaves[0].type != token.STRING: + return False + value = self.leaves[0].value + if value.startswith(('"""', "'''")): + return True + if Preview.accept_raw_docstrings in self.mode and value.startswith( + ("r'''", 'r"""', "R'''", 'R"""') + ): + return True + return False @property def opens_block(self) -> bool: