VScode中的sphinx和autodocstring与python-cod

2024-10-01 04:44:57 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在和使用vscode的人合作一个项目。我们编写Python代码。 我让他们为他们的函数生成docstring,他们使用了vscode中的Autodocstring。这是他们想出的一个docstring:

"""
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
"""

应该是谷歌风格的docstring。在

当我用Sphinx生成一个html文档时,下面是我得到的:

enter image description here

我应该得到这样的东西:

enter image description here

斯芬克斯配置中是否缺少一个选项?或者Autodocstring坏了?在


Tags: thetopath项目函数代码vscodemethod
1条回答
网友
1楼 · 发布于 2024-10-01 04:44:57

您显示的语法不是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样式的docstring(查找autoDocstring.docstringFormat)。在

相关问题 更多 >