代码之家  ›  专栏  ›  技术社区  ›  JPFrancoia

使用python代码的VScode中的sphinx和autodocstring

  •  0
  • JPFrancoia  · 技术社区  · 6 年前

    我正在与使用vscode的人合作一个项目。我们编写Python代码。 我让他们为自己的函数生成docstring,他们使用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
    """
    

    应该是谷歌风格的docstring。

    enter image description here

    当我得到这样的东西时:

    enter image description here

    我是否缺少狮身人面像配置中的选项?或者是Autodocstring断了?

    1 回复  |  直到 6 年前
        1
  •  2
  •   charlie80    5 年前

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