Omit extra space in Sphinx auto-attribute comments
This feature of Sphinx is described in: http://www.sphinx-doc.org/en/stable/ext/autodoc.html#directive-autoattribute Fixes #68
This commit is contained in:
parent
cf6f577928
commit
475179a53a
@ -324,6 +324,9 @@ More details can be found in [CONTRIBUTING](CONTRIBUTING.md).
|
||||
|
||||
* omit extra space in kwarg unpacking if it's the first argument (#46)
|
||||
|
||||
* omit extra space in [Sphinx auto-attribute comments](http://www.sphinx-doc.org/en/stable/ext/autodoc.html#directive-autoattribute)
|
||||
(#68)
|
||||
|
||||
|
||||
### 18.3a3
|
||||
|
||||
|
2
black.py
2
black.py
@ -1183,7 +1183,7 @@ def make_comment(content: str) -> str:
|
||||
|
||||
if content[0] == '#':
|
||||
content = content[1:]
|
||||
if content and content[0] not in {' ', '!', '#'}:
|
||||
if content and content[0] not in ' !:#':
|
||||
content = ' ' + content
|
||||
return '#' + content
|
||||
|
||||
|
@ -49,6 +49,26 @@ def function(default=None):
|
||||
# This time two lines.
|
||||
|
||||
|
||||
class Foo:
|
||||
"""Docstring for class Foo. Example from Sphinx docs."""
|
||||
|
||||
#: Doc comment for class attribute Foo.bar.
|
||||
#: It can have multiple lines.
|
||||
bar = 1
|
||||
|
||||
flox = 1.5 #: Doc comment for Foo.flox. One line only.
|
||||
|
||||
baz = 2
|
||||
"""Docstring for class attribute Foo.baz."""
|
||||
|
||||
def __init__(self):
|
||||
#: Doc comment for instance attribute qux.
|
||||
self.qux = 3
|
||||
|
||||
self.spam = 4
|
||||
"""Docstring for instance attribute spam."""
|
||||
|
||||
|
||||
@fast(really=True)
|
||||
async def wat():
|
||||
async with X.open_async() as x: # Some more comments
|
||||
|
Loading…
Reference in New Issue
Block a user