我正在与使用vscode的人合作开展一个项目。我们编写Python代码。我让他们为他们的函数生成docstrings,他们使用了vscode的Autodocstring。这是他们提出的文档字符串:
"""
Subclass ObjectCAD renderToFile method to render the scad file
in renders_dir
Arguments:
file_path {str} -- the destination path for the scad file
Returns:
None
"""
它应该是Google风格的文档字符串。
当我用Sphinx生成一个html doc时,我得到的是:
虽然我应该得到类似的东西:
我错过了sphinx配置的选项吗?或者Autodocstring坏了吗?
您显示的语法不是Google风格的语法(有关详细示例,请参阅here)。它应该是:
"""
Subclass ObjectCAD renderToFile method to render the scad file
in renders_dir
Args:
file_path (str): the destination path for the scad file
Returns:
None
"""
必须正确配置VSCode的autoDocstring扩展以生成Google风格的文档字符串(查找autoDocstring.docstringFormat
)。