gpt4 book ai didi

python - 来自 VScode 的 sphinx 和 autodocstring 以及 python 代码

转载 作者:行者123 更新时间:2023-12-05 02:15:34 30 4
gpt4 key购买 nike

我正在与使用 vscode 的人合作开展一个项目。我们编写 Python 代码。我让他们为他们的函数生成文档字符串,他们使用了 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 文档时,我得到了以下信息:

enter image description here

虽然我应该得到类似的东西:

enter image description here

我是否缺少 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
"""

autoDocstring必须正确配置 VSCode 的扩展以生成 Google 风格的文档字符串(查找 autoDocstring.docstringFormat)。

关于python - 来自 VScode 的 sphinx 和 autodocstring 以及 python 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51591245/

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