我遵循numpydoc 风格指南来记录我的代码,但找不到返回类实例的约定:
"""Create an index in the meilisearch API.
If the argument \`uid\` isn't passed in, it will be generated by meilisearch.
If the argument \`name\` isn't passed in, it will raise an error.
Parameters
----------
name: str
Name of the index
uid: str, optional
Unique identifier of the index
Raises
------
HTTPError
If no name is passed in as a parameter.
HTTPError
In case of any other error found here https://docs.meilisearch.com/references/#errors-status-code
Returns
-------
index
an instance of Index containing the information of the newly created index
"""在returns部分中,如您所见,我返回一个Index实例。这就是记录它的方法吗?
提前感谢
发布于 2019-12-09 14:57:01
5.返回 解释返回的值及其类型。与参数部分类似,每个返回值的名称都是可选的。每个返回值的类型都是必需的。
Returns
-------
int
Description of anonymous integer return value.因此,对于您的示例,您将使用Index作为类型,以及一个可选的名称:
Returns
-------
index : Index
<some meaningful description here>在这里,index :部分是可选的。
https://stackoverflow.com/questions/59251348
复制相似问题