gpt4 book ai didi

python - 如何解决 pydocstyle 错误 "D205: 1 blank line required between summary line and description (found 0)"?

转载 作者:行者123 更新时间:2023-11-28 22:17:55 41 4
gpt4 key购买 nike

我正在尝试使用 pydocstyle 检查我的文档字符串的质量,但出现此错误:

D205:摘要行和描述之间需要 1 个空行(找到 0 个)

我的代码是这样的

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)

当我像这样在文档字符串和函数语句之间放置一个空行时;

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)

我得到这个错误:

D202:函数文档字符串后不允许有空行(找到 1 个)

我该如何解决这个问题?感谢您的帮助。

最佳答案

参见 PEP 257 -- Docstring Conventions

def func(input):
"""**summary line, max. 79 chars including period** 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)

关于python - 如何解决 pydocstyle 错误 "D205: 1 blank line required between summary line and description (found 0)"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50924700/

41 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com