目前,我有一些代码使用了类似这样的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?