How can I resolve pydocstyle error "D205: 1 blank line required between summary line and description (found 0)"?
Solution 1
See PEP 257 -- Docstring Conventions
def func(input):
"""**summary line** Function to do something interesting.
**description starts after blank line above**
Args:
-input- Input of the function
Returns:
output- Output of the function
"""
# no blank line allowed here
data = [words, sentences]
corpus = somefunction(data)
Solution 2
To Solve this, add a blank line after the first line of the Docstring.
According to PEP 257 -- Docstring Conventions, a Multi-line docstring consists of a Summary line(1st line) just like a one-line docstring, followed by a blank line and then a more Elaborate description follows. It is important that the summary line fits on one line and is separated from the rest of the docstring by a blank line.
def func(input):
"""Function that does something interesting.
Args:
- input - Input of the function
Returns:
- output - Output of the function
"""
data = words + sentences
corpus = somefunction(data)
Note
- The Summary line can begin on the same line as the opening quotes or on the next line, preferably, the former.
- There should be no blank lines after the opening quotes or before the closing quotes.
![Richard Ackon](https://i.stack.imgur.com/JqA4p.jpg?s=256&g=1)
Comments
-
Richard Ackon about 2 years
I'm trying to use pydocstyle to check the quality of my docstring and I'm getting this error:
D205: 1 blank line required between summary line and description (found 0)
This is how my code looks like
def func(input): """ Function that does something interesting. Args: -input- Input of the function Returns: output- Output of the function """ data = words + sentences corpus= somefunction(data)
When I put a blank line between the docstring and the function statements like so;
def func(input): """ Function that does something interesting. Args: -input- Input of the function Returns: output- Output of the function """ data = words + sentences corpus= somefunction(data)
I get the this errror:
D202: No blank lines allowed after function docstring (found 1)
How do I resolve this? Thanks for you help.
-
ack about 3 years@Lutaaya The summary line should be
one
line, followed by ablank
line.