[Bf-blender-cvs] [fe0b6b564b8] lanpr-under-gp: API Docs: Use raises field list syntax

Aaron Carlisle noreply at git.blender.org
Fri Oct 2 07:40:25 CEST 2020


Commit: fe0b6b564b8a02f36496d1c05e2ff31449bb0b5e
Author: Aaron Carlisle
Date:   Tue Sep 29 15:05:45 2020 -0400
Branches: lanpr-under-gp
https://developer.blender.org/rBfe0b6b564b8a02f36496d1c05e2ff31449bb0b5e

API Docs: Use raises field list syntax

See 
https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#info-field-lists

===================================================================

M	source/blender/python/intern/bpy_rna.c
M	source/blender/python/intern/bpy_utils_previews.c
M	source/blender/python/mathutils/mathutils_Matrix.c

===================================================================

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 <https://en.wikipedia.org/wiki/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);



More information about the Bf-blender-cvs mailing list