[英]Sphinx autodoc extension for python > 3.5 docstrings not working because of function argument types
我一直在尝试让 autodoc 自动记录我的 python 3.7 模块。 我需要记录的唯一文件是单个模块中的init .py 文件。 该文件仅包含函数并具有 Sphinx 格式的文档字符串。 到现在为止还挺好。 但是,我的函数有它们的参数类型,例如:
def func1(filepaths: list):
...
def log_custom_hyperparameter(model, param_name: str, param_value):
...
这是在抛弃 autodoc。 我收到以下错误:
WARNING: autodoc: failed to import module u'<my_module>'; the following exception was raised:
Traceback (most recent call last):
File "/Users/manjotpahwa/Library/Python/2.7/lib/python/site-packages/sphinx/ext/autodoc/importer.py", line 154, in import_module
__import__(modname)
File "/Users/manjotpahwa/<path to file>/__init__.py", line 9
def log_code_files(filepaths: list):
^
SyntaxError: invalid syntax
autodoc 不支持解析 python 文件 > python 3.5 吗?
谢谢
其实我想我找到了这个问题的答案。 原来我的 sphinx 使用的是 python 2.7 站点包。 这有帮助: 如何强制 Sphinx 使用 Python 3.x 解释器
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.