-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to include empty docstring #2168
Comments
Black 21.4b0 introduced a change in how docstrings are handled. This breaks removing methods for sphinx. See psf/black#2168 This change should fix travis, which has been failing since the 21.4b0 release.
See #2150 for some similar previous discussion. I'm supportive of leaving empty docstrings alone to support this use case. |
If #2150 resolves in favor of reducing AST modifications that would certainly fix this bug. However a special case allowing empty docstrings would be sufficient for my use case. |
This is impacting the urllib3 documentation, we use an empty docstring to avoid having subclass methods from Python's Reference: urllib3/urllib3#2239 |
Resolves #2168 by disabling the insertion of a " " when the docstring is entirely empty. Note that this PR is focussed only on the case of empty docstrings. In particular this does not make any changes to the behaviour that a " " is inserted if a non-empty docstring begins with the quoting character. That is, black still prefers: """ "something" """ to: """"something" """ and that: """"Something"""" is not a legal docstring.
Black 21.4b0 introduced a change in how docstrings are handled. This breaks removing methods for sphinx. See psf/black#2168 This change should fix travis, which has been failing since the 21.4b0 release.
Empty docstrings are used by sphinx to indicate methods that should not be included in the documentation. However, as of 21.4b0 black reformats empty docstrings to contain a space.
To Reproduce:
Source:
gets reformatted to
Expected behavior I'm generally supportive of the style changes introduced in #1740. However, in this case black is changing the code in a meaningful way. I suggest that empty docstrings be ignored as a special case. I am agnostic on whether the empty docstring should be spelled
""
or""""""
.Environment:
Does this bug also happen on master? Yes
The text was updated successfully, but these errors were encountered: