From 4c3047a9cdff686411077b1ccd5709eb221bf41a Mon Sep 17 00:00:00 2001 From: Aaron Carlisle Date: Tue, 29 Sep 2020 15:05:45 -0400 Subject: API Docs: Use raises field list syntax See https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#info-field-lists --- source/blender/python/intern/bpy_rna.c | 7 ++----- source/blender/python/intern/bpy_utils_previews.c | 19 +++++++++---------- source/blender/python/mathutils/mathutils_Matrix.c | 5 ++--- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index cac82b158d3..e71adbfdf62 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -8708,11 +8708,8 @@ PyDoc_STRVAR(pyrna_register_class_doc, " If the class has a *register* class method it will be called\n" " before registration.\n" "\n" - " .. note::\n" - "\n" - " :exc:`ValueError` exception is raised if the class is not a\n" - " subclass of a registerable blender class.\n" - "\n"); + " :raises ValueError:\n" + " if the class is not a subclass of a registerable blender class.\n"); PyMethodDef meth_bpy_register_class = { "register_class", pyrna_register_class, METH_O, pyrna_register_class_doc}; static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class) diff --git a/source/blender/python/intern/bpy_utils_previews.c b/source/blender/python/intern/bpy_utils_previews.c index 32cd7bdddc3..7a826d99a3d 100644 --- a/source/blender/python/intern/bpy_utils_previews.c +++ b/source/blender/python/intern/bpy_utils_previews.c @@ -55,14 +55,14 @@ PyDoc_STRVAR( "\n" " Generate a new empty preview.\n" "\n" - /* This is only true when accessed via 'bpy.utils.previews.ImagePreviewCollection.new', - * however this is the public API, allow this minor difference to the internal version here. */ - " If ``name`` already exists a KeyError exception is raised.\n" - "\n" " :arg name: The name (unique id) identifying the preview.\n" " :type name: string\n" " :return: The Preview matching given name, or a new empty one.\n" - " :rtype: :class:`bpy.types.ImagePreview`\n"); + " :rtype: :class:`bpy.types.ImagePreview`\n" + " :rtype: :class:`bpy.types.ImagePreview`\n" + /* This is only true when accessed via 'bpy.utils.previews.ImagePreviewCollection.load', + * however this is the public API, allow this minor difference to the internal version here. */ + " :raises KeyError: if ``name`` already exists."); static PyObject *bpy_utils_previews_new(PyObject *UNUSED(self), PyObject *args) { char *name; @@ -85,10 +85,6 @@ PyDoc_STRVAR( "\n" " Generate a new preview from given file path.\n" "\n" - /* This is only true when accessed via 'bpy.utils.previews.ImagePreviewCollection.load', - * however this is the public API, allow this minor difference to the internal version here. */ - " If ``name`` already exists a KeyError exception is raised.\n" - "\n" " :arg name: The name (unique id) identifying the preview.\n" " :type name: string\n" " :arg filepath: The file path to generate the preview from.\n" @@ -100,7 +96,10 @@ PyDoc_STRVAR( "exists in cache.\n" " :type force_reload: bool\n" " :return: The Preview matching given name, or a new empty one.\n" - " :rtype: :class:`bpy.types.ImagePreview`\n"); + " :rtype: :class:`bpy.types.ImagePreview`\n" + /* This is only true when accessed via 'bpy.utils.previews.ImagePreviewCollection.load', + * however this is the public API, allow this minor difference to the internal version here. */ + " :raises KeyError: if ``name`` already exists."); static PyObject *bpy_utils_previews_load(PyObject *UNUSED(self), PyObject *args) { char *name, *path, *path_type_s; diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index c158ec1da15..427fcad5155 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -1687,7 +1687,7 @@ PyDoc_STRVAR( "\n" " Set the matrix to its adjugate.\n" "\n" - " .. note:: When the matrix cannot be adjugated a :exc:`ValueError` exception is raised.\n" + " :raises ValueError: if the matrix cannot be adjugate.\n" "\n" " .. seealso:: `Adjugate matrix `__ on " "Wikipedia.\n"); @@ -1726,8 +1726,7 @@ PyDoc_STRVAR( "\n" " :return: the adjugated matrix.\n" " :rtype: :class:`Matrix`\n" - "\n" - " .. note:: When the matrix cant be adjugated a :exc:`ValueError` exception is raised.\n"); + " :raises ValueError: if the matrix cannot be adjugated\n"); static PyObject *Matrix_adjugated(MatrixObject *self) { return matrix__apply_to_copy(Matrix_adjugate, self); -- cgit v1.2.3