Sphinx autodoc python扩展>;3.5由于函数参数类型,docstring无法工作

Sphinx autodoc python扩展>;3.5由于函数参数类型,docstring无法工作,python,python-sphinx,read-the-docs,Python,Python Sphinx,Read The Docs,我一直在尝试让autodoc自动记录我的python 3.7模块。我需要记录的唯一文件是单个模块中的init.py文件。该文件仅包含函数,并且具有Sphinx格式的docstring。到现在为止,一直都还不错。 但是,my函数的参数类型如下: def func1(filepaths: list): ... def log_custom_hyperparameter(model, param_name: str, param_value): ... 这是扔掉autodoc。我得到以下错

我一直在尝试让autodoc自动记录我的python 3.7模块。我需要记录的唯一文件是单个模块中的init.py文件。该文件仅包含函数,并且具有Sphinx格式的docstring。到现在为止,一直都还不错。 但是,my函数的参数类型如下:

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:无法导入模块u';引发了以下异常:
回溯(最近一次呼叫最后一次):
文件“/Users/manjotpaha/Library/Python/2.7/lib/Python/site packages/sphinx/ext/autodoc/importer.py”,第154行,在导入模块中
__导入(modname)
文件“/Users/manjotpahwa/\\\\\\\\\\\\\\\\\\.py”,第9行
def日志代码文件(文件路径:列表):
^
SyntaxError:无效语法
autodoc是否不支持解析python文件>python 3.5


谢谢

事实上我想我找到了这个问题的答案。原来我的sphinx使用的是python 2.7站点包。 这有助于: