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.
summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
18c17be)
Doing so is invalid. Note this only fixes the preview style since the
logic putting closing docstring quotes on their own line if they violate
the line length limit is quite new.
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
<!-- Changes that affect Black's preview style -->
<!-- Changes that affect Black's preview style -->
+- Single-character closing docstring quotes are no longer moved to their own line as
+ this is invalid. This was a bug introduced in version 22.6.0. (#3166)
+
### _Blackd_
<!-- Changes to blackd -->
### _Blackd_
<!-- Changes to blackd -->
# We could enforce triple quotes at this point.
quote = quote_char * quote_len
# We could enforce triple quotes at this point.
quote = quote_char * quote_len
- if Preview.long_docstring_quotes_on_newline in self.mode:
+ # It's invalid to put closing single-character quotes on a new line.
+ if Preview.long_docstring_quotes_on_newline in self.mode and quote_len == 3:
# We need to find the length of the last line of the docstring
# to find if we can add the closing quotes to the line without
# exceeding the maximum line length.
# If docstring is one line, then we need to add the length
# We need to find the length of the last line of the docstring
# to find if we can add the closing quotes to the line without
# exceeding the maximum line length.
# If docstring is one line, then we need to add the length
- # of the indent, prefix, and starting quotes. Ending quote are
- # handled later
+ # of the indent, prefix, and starting quotes. Ending quotes are
+ # handled later.
lines = docstring.splitlines()
last_line_length = len(lines[-1]) if docstring else 0
lines = docstring.splitlines()
last_line_length = len(lines[-1]) if docstring else 0
second line----------------------------------------------------------------------"""
second line----------------------------------------------------------------------"""
+def single_quote_docstring_over_line_limit():
+ "We do not want to put the closing quote on a new line as that is invalid (see GH-3141)."
+
+
+def single_quote_docstring_over_line_limit2():
+ 'We do not want to put the closing quote on a new line as that is invalid (see GH-3141).'
+
+
f"""first line----------------------------------------------------------------------
second line----------------------------------------------------------------------"""
f"""first line----------------------------------------------------------------------
second line----------------------------------------------------------------------"""
+
+
+def single_quote_docstring_over_line_limit():
+ "We do not want to put the closing quote on a new line as that is invalid (see GH-3141)."
+
+
+def single_quote_docstring_over_line_limit2():
+ "We do not want to put the closing quote on a new line as that is invalid (see GH-3141)."