你如何修复 "Missing module docstringpylint(missing-module-docstring)"
How do you fix "Missing module docstringpylint(missing-module-docstring)"
我在 VSCode 上使用 pygame 模块,我 运行 解决了 pygame 没有初始化成员的问题。我遵循了 this link 的解决方案。我编辑了用户设置并添加了
"python.linting.pylintArgs": [
"--extension-pkg-whitelist=pygame",
"--unsafe-load-any-extension=y"
]
到 json 文件的末尾
pygame 问题已解决。但是,当我使用 import random
时。我收到此警告:
缺少模块 docstringpylint(缺少模块文档字符串)
如何让它消失?还有,有没有更好的办法解决pygame的初始化问题?
谢谢!
我刚刚弄清楚文档字符串是什么。他们只是描述功能或class。它用三个双引号或单引号括起来。 This 帮助了我。
为了删除 VSCode 中的文档字符串警告,我刚刚将 "--disable=C0111"
添加到 "python.linting.pylintArgs": []
,这是在用户的 JSON 设置中。
python 模块的文档字符串记录了该文件内容的用途。
您可以通过在模块顶部添加文档字符串来解决此错误:
"""
Provides some arithmetic functions
"""
def add(a, b):
"""Add two numbers"""
return a + b
def mult(a, b):
"""Multiply two numbers"""
return a * b
在 https://www.python.org/dev/peps/pep-0257/#multi-line-docstrings
阅读更多内容
当我们在没有.pylintrc 的目录中使用pylint 时会出现此错误。从那里转到包含 .pylintrc 和 运行 的目录。
示例:
测试/
test1.py
test2/test2.py
.pylintrc
如果你想 运行 pylint for test2.py inside test/test2 那么你会得到那个错误。
test/test2$ pylint test2.py is wrong.
test$ pylint test2.py is correct.
我在 VSCode 上使用 pygame 模块,我 运行 解决了 pygame 没有初始化成员的问题。我遵循了 this link 的解决方案。我编辑了用户设置并添加了
"python.linting.pylintArgs": [
"--extension-pkg-whitelist=pygame",
"--unsafe-load-any-extension=y"
]
到 json 文件的末尾
pygame 问题已解决。但是,当我使用 import random
时。我收到此警告:
缺少模块 docstringpylint(缺少模块文档字符串)
如何让它消失?还有,有没有更好的办法解决pygame的初始化问题?
谢谢!
我刚刚弄清楚文档字符串是什么。他们只是描述功能或class。它用三个双引号或单引号括起来。 This 帮助了我。
为了删除 VSCode 中的文档字符串警告,我刚刚将 "--disable=C0111"
添加到 "python.linting.pylintArgs": []
,这是在用户的 JSON 设置中。
python 模块的文档字符串记录了该文件内容的用途。
您可以通过在模块顶部添加文档字符串来解决此错误:
"""
Provides some arithmetic functions
"""
def add(a, b):
"""Add two numbers"""
return a + b
def mult(a, b):
"""Multiply two numbers"""
return a * b
在 https://www.python.org/dev/peps/pep-0257/#multi-line-docstrings
阅读更多内容当我们在没有.pylintrc 的目录中使用pylint 时会出现此错误。从那里转到包含 .pylintrc 和 运行 的目录。
示例:
测试/ test1.py test2/test2.py .pylintrc
如果你想 运行 pylint for test2.py inside test/test2 那么你会得到那个错误。
test/test2$ pylint test2.py is wrong.
test$ pylint test2.py is correct.