From 18783c5699a30231900d4e494f88d150d909c591 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 21 Jan 2025 16:51:40 +1100 Subject: [PATCH] Cleanup: correct RST syntax, spelling & adjust quotes --- .../examples/bpy.types.HydraRenderEngine.py | 4 ++-- doc/python_api/examples/bpy.types.USDHook.py | 2 +- doc/python_api/rst/info_overview.rst | 17 +++++++++-------- source/blender/makesrna/intern/rna_define.cc | 2 +- .../nodes/shader/materialx/node_graph.cc | 4 ++-- .../python/intern/bpy_rna_id_collection.cc | 2 +- tests/blender_as_python_module/import_bpy.py | 4 ++-- 7 files changed, 18 insertions(+), 17 deletions(-) diff --git a/doc/python_api/examples/bpy.types.HydraRenderEngine.py b/doc/python_api/examples/bpy.types.HydraRenderEngine.py index 14a17d18135..1d53e081cf7 100644 --- a/doc/python_api/examples/bpy.types.HydraRenderEngine.py +++ b/doc/python_api/examples/bpy.types.HydraRenderEngine.py @@ -16,13 +16,13 @@ class CustomHydraRenderEngine(bpy.types.HydraRenderEngine): # Name of the render plugin. bl_delegate_id = "HdCustomRendererPlugin" - # Use MaterialX instead of UsdPreviewSurface for materials. + # Use MaterialX instead of `UsdPreviewSurface` for materials. bl_use_materialx = True # Register path to plugin. @classmethod def register(cls): - # Make pxr module available, for running as bpy pip package. + # Make `pxr` module available, for running as `bpy` PIP package. bpy.utils.expose_bundled_modules() import pxr.Plug diff --git a/doc/python_api/examples/bpy.types.USDHook.py b/doc/python_api/examples/bpy.types.USDHook.py index 5123527e3e8..2edac15673e 100644 --- a/doc/python_api/examples/bpy.types.USDHook.py +++ b/doc/python_api/examples/bpy.types.USDHook.py @@ -187,7 +187,7 @@ import bpy import bpy.types import textwrap -# Make pxr module available, for running as bpy pip package. +# Make `pxr` module available, for running as `bpy` PIP package. bpy.utils.expose_bundled_modules() import pxr.Gf as Gf diff --git a/doc/python_api/rst/info_overview.rst b/doc/python_api/rst/info_overview.rst index 0488b82b5be..05460abc69a 100644 --- a/doc/python_api/rst/info_overview.rst +++ b/doc/python_api/rst/info_overview.rst @@ -213,7 +213,7 @@ otherwise Blender's internal initialization won't happen properly: .. note:: - In case you are using complex/multi-inheritance, `super()` may not work. It is best then to + In case you are using complex/multi-inheritance, ``super()`` may not work. It is best then to explicitly invoke the Blender-defined parent class constructor. For example: .. code-block:: python @@ -239,7 +239,7 @@ otherwise Blender's internal initialization won't happen properly: C++-defined Blender types do not define or use a ``__del__()`` (aka ``tp_finalize()``) destructor currently. As this function - `does not exist if not explicitely defined `__, + `does not exist if not explicitly defined `__, that means that calling ``super().__del__()`` in the ``__del__()`` function of a sub-class will fail with the following error: ``AttributeError: 'super' object has no attribute '__del__'``. @@ -439,17 +439,18 @@ and it may be useful to define them as types and remove them on the fly. .. code-block:: python for i in range(10): - idname = "object.operator_%d" % i + idname = "object.operator_{:d}".format(i) def func(self, context): print("Hello World", self.bl_idname) return {'FINISHED'} - opclass = type("DynOp%d" % i, - (bpy.types.Operator, ), - {"bl_idname": idname, "bl_label": "Test", "execute": func}, - ) - bpy.utils.register_class(opclass) + op_class = type( + "DynOp{:d}".format(i), + (bpy.types.Operator, ), + {"bl_idname": idname, "bl_label": "Test", "execute": func}, + ) + bpy.utils.register_class(op_class) .. note:: diff --git a/source/blender/makesrna/intern/rna_define.cc b/source/blender/makesrna/intern/rna_define.cc index 6d4ee7bd547..c92b507eee8 100644 --- a/source/blender/makesrna/intern/rna_define.cc +++ b/source/blender/makesrna/intern/rna_define.cc @@ -53,7 +53,7 @@ static CLG_LogRef LOG = {"rna.define"}; /** * Several types cannot use all their bytes to store a bit-set (bit-shift operations on negative - * numbers are 'arithmetic", i.e. preserve the sign, i.e. are not 'pure' binary shifting). + * numbers are "arithmetic", i.e. preserve the sign, i.e. are not "pure" binary shifting). * * Currently, all signed types and `uint64_t` cannot use their left-most bit (i.e. sign bit). */ diff --git a/source/blender/nodes/shader/materialx/node_graph.cc b/source/blender/nodes/shader/materialx/node_graph.cc index e1b270e9b5d..c8a270a2b16 100644 --- a/source/blender/nodes/shader/materialx/node_graph.cc +++ b/source/blender/nodes/shader/materialx/node_graph.cc @@ -122,7 +122,7 @@ std::string NodeGraph::unique_node_name(const bNode *node, return *existing_name; } - /* Generate name based on noode, socket, to type and node groups. */ + /* Generate name based on node, socket, to type and node groups. */ std::string name = node->name; if (!socket_out_name.is_empty() && node->output_sockets().size() > 1) { @@ -134,7 +134,7 @@ std::string NodeGraph::unique_node_name(const bNode *node, name = node_name_prefix_ + valid_name(name); - /* Avoid conflicts with anonymouse node names. */ + /* Avoid conflicts with anonymous node names. */ if (StringRef(name).startswith(ANONYMOUS_NODE_NAME_PREFIX)) { name = "b" + name; } diff --git a/source/blender/python/intern/bpy_rna_id_collection.cc b/source/blender/python/intern/bpy_rna_id_collection.cc index 8ac218cfc84..242ca8e0b35 100644 --- a/source/blender/python/intern/bpy_rna_id_collection.cc +++ b/source/blender/python/intern/bpy_rna_id_collection.cc @@ -408,7 +408,7 @@ static PyObject *bpy_file_path_map(PyObject * /*self*/, PyObject *args, PyObject bpath_data.bmain = bmain; bpath_data.callback_function = foreach_id_file_path_map_callback; - /* TODO: needs to be controlable from caller (add more options to the API). */ + /* TODO: needs to be controllable from caller (add more options to the API). */ bpath_data.flag = BKE_BPATH_FOREACH_PATH_SKIP_PACKED | BKE_BPATH_TRAVERSE_SKIP_WEAK_REFERENCES; bpath_data.user_data = &filepathmap_data; diff --git a/tests/blender_as_python_module/import_bpy.py b/tests/blender_as_python_module/import_bpy.py index 9d424d7d693..46617208764 100644 --- a/tests/blender_as_python_module/import_bpy.py +++ b/tests/blender_as_python_module/import_bpy.py @@ -6,10 +6,10 @@ import sys sys.path.append(sys.argv[1]) -# Just import bpy and see if there are any dynamic loader errors. +# Just import `bpy` and see if there are any dynamic loader errors. import bpy -# Try bundled libraries +# Try bundled libraries. bpy.utils.expose_bundled_modules() from pxr import Usd