我正在将sphinx文档添加到几个项目中,但我担心未来的开发人员在方法界面更改时不会严格更新文档.有没有办法让sphinx根据方法定义中实际指定的内容验证所描述的参数列表?
例如,假设我使用sphinx-quickstart设置了sphinx,添加了autodoc,并且我正在尝试构建以下"模块":
def product(arg_one, arg_two):
'''
:param arg_one: an object to be multiplied by arg_two
:type arg_one: Object
:param arg_two: an integer which defines the number of arg_one to return
:type arg_two: integer
:returns: The product of arg_one and arg_two
:raises: TypeError
'''
return arg_one * arg_two
Run Code Online (Sandbox Code Playgroud)
而且,从现在起一周后,Bob Doe更新产品如下:
def product(value, number, catch_errors=False):
'''
:param arg_one: an object to be multiplied by arg_two
:type arg_one: Object
:param arg_two: an integer which defines the number of arg_one to return
:type arg_two: …Run Code Online (Sandbox Code Playgroud)