Sphinx自动文档与mypy类型注释

7

目前,我有一些代码使用了类似这样的mypy类型注释:

def translate(self, text, mark_unknown=False, format=None, deformat='txt', reformat='txt'):
    # type: (Translator, str, bool, Optional[str], str, str) -> str

我希望使用Sphinx的自动文档扩展来记录它,但目前看来,autodoc并不识别这些注释,因此在生成的文档中这些注释不会显示。

是否有任何简单的解决方法,例如其他扩展或autodoc选项,或者必须编写包含相关信息的实际docstring?


1
这个回答解决了你的问题吗?如何在Sphinx文档中自动添加参数类型 - NLindros
1个回答

1

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接