X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/db30456916ca733d011a2774e66beb3dd7064e14..b55ea63ff4858109fe4606a6caafb03fda946743:/src/black/__init__.py diff --git a/src/black/__init__.py b/src/black/__init__.py index 99afc7d..015ca41 100644 --- a/src/black/__init__.py +++ b/src/black/__init__.py @@ -2186,7 +2186,13 @@ class LineGenerator(Visitor[Line]): if docstring[0] == quote_char: docstring = " " + docstring if docstring[-1] == quote_char: - docstring = docstring + " " + docstring += " " + if docstring[-1] == "\\": + backslash_count = len(docstring) - len(docstring.rstrip("\\")) + if backslash_count % 2: + # Odd number of tailing backslashes, add some padding to + # avoid escaping the closing string quote. + docstring += " " else: # Add some padding if the docstring is empty. docstring = " " @@ -5618,6 +5624,9 @@ def maybe_make_parens_invisible_in_atom(node: LN, parent: LN) -> bool: syms.expr_stmt, syms.assert_stmt, syms.return_stmt, + # these ones aren't useful to end users, but they do please fuzzers + syms.for_stmt, + syms.del_stmt, ]: return False