我似乎不知道如何使用Sphinx记录异常。
我尝试过以下几种方法:
def some_funct():
"""
:raises: ExceptionType: Some multi-line
exception description.
"""
def some_funct():
"""
:raises: ExceptionType, Some multi-line
exception description.
"""
def some_funct():
"""
:raises ExceptionType: Some multi-line
exception description.
"""
def some_funct():
"""
:raises:
ExceptionType: Some multi-line
exception description.
"""
斯芬克斯一直在说:
“字段列表以空行结束;意外取消缩进。”
那么,我如何摆脱这一消息,以及用多行文档记录可能存在的多个异常的正确方法是什么?
发布于 2013-04-12 22:04:58
您可以使用反斜杠作为行续行符:
def some_funct():
"""
:raises ExceptionType: Some multi-line \
exception description.
"""
更新:
缩进看起来很有效,而不是转义换行符:
def some_funct():
"""
:raises ExceptionType: Some multi-line
exception description.
"""
发布于 2014-10-08 18:56:08
def some_funct():
"""
My documentation, but watch the empty line below (necessary)
:raise: Exception
when status != my_status
| status <= max_status
注意:https://pythonhosted.org/an_example_pypi_project/sphinx.html#full-code-example有一些很好的示例(不幸的是不是多行异常)
发布于 2013-04-12 21:36:36
这给了我一些好东西。
在异常名称之前忘记了:
def some_funct():
"""
:raise:
:IOException: a probleme occured
and it can't be passed
"""
https://stackoverflow.com/questions/15972544
复制相似问题