PyDoc: correct use of single back-ticks

This commit is contained in:
Campbell Barton 2024-11-03 19:18:34 +11:00
parent 901359abf7
commit b00550916c
23 changed files with 52 additions and 50 deletions

View file

@ -1032,8 +1032,8 @@ class PackageInstaller:
@classmethod
def version_match(cls, version, ref_version):
"""
Return True if the `version` string falls into the version range covered by the `ref_version` string.
`version` should be at least as long as `ref_version` (in term of version number items).
Return True if the ``version`` string falls into the version range covered by the ``ref_version`` string.
``version`` should be at least as long as ``ref_version`` (in term of version number items).
E.g. 3.3.2:
- matches 3.3
- matches 3.3.2
@ -1162,12 +1162,12 @@ class PackageInstaller:
def package_find(self, package, package_distro_name):
"""
Generic heuristics to try and find 'best matching version' for a given package.
For most packages it just ensures given package name version matches the exact version from the `package`,
For most packages it just ensures given package name version matches the exact version from the ``package``,
or at least fits within the [version_min, version_mex[ range.
But some, like e.g. python, llvm or boost, can have packages available for several versions,
with complex naming (like 'python3.10', 'llvm-9-dev', etc.).
This code attempts to find the best matching one possible, based on a set of 'possible names'
generated by the distro-specific `package_name_version_gen` generator.
generated by the distro-specific ``package_name_version_gen`` generator.
"""
# Check 'exact' version match on given name.
if self.package_query_version_match(package_distro_name, package.version_short):
@ -1220,7 +1220,7 @@ class PackageInstaller:
def packages_install(self, packages, parent_packages=()):
"""
Install all given packages and their sub-packages.
This call is recursive, parent_packages is a tuple of the ancestors of current `package`, in calling order
This call is recursive, parent_packages is a tuple of the ancestors of current ``package``, in calling order
(grand-parent, parent).
"""
def package_info_name(package, parent_packages):

View file

@ -4,7 +4,7 @@ Getter/Setter Example
Getter/setter functions can be used for boolean, int, float, string and enum properties.
If these callbacks are defined the property will not be stored in the ID properties
automatically. Instead, the `get` and `set` functions will be called when the property
automatically. Instead, the ``get`` and ``set`` functions will be called when the property
is respectively read or written from the API.
.. warning::

View file

@ -7,7 +7,7 @@ A batch contains the necessary data to perform the drawing.
That includes an obligatory *Vertex Buffer* and an optional *Index Buffer*,
each of which is described in more detail in the following sections.
A batch also defines a draw type.
Typical draw types are `POINTS`, `LINES` and `TRIS`.
Typical draw types are ``POINTS``, ``LINES`` and ``TRIS``.
The draw type determines how the data will be interpreted and drawn.
Vertex Buffers
@ -63,7 +63,7 @@ For instance, to draw a rectangle composed of two triangles, one could use an in
ibo = gpu.types.GPUIndexBuf(type='TRIS', seq=indices)
Here the first tuple in `indices` describes which vertices should be used for the first triangle
Here the first tuple in ``indices`` describes which vertices should be used for the first triangle
(same for the second tuple).
Note how the diagonal vertices 1 and 2 are shared between both triangles.
@ -77,12 +77,12 @@ Typically multiple shaders are linked together into a *Program*.
However, in the Blender Python API the term *Shader* refers to an OpenGL Program.
Every :class:`gpu.types.GPUShader` consists of a vertex shader, a fragment shader and an optional geometry shader.
For common drawing tasks there are some built-in shaders accessible from :class:`gpu.shader.from_builtin`
with an identifier such as `UNIFORM_COLOR` or `FLAT_COLOR`.
with an identifier such as ``UNIFORM_COLOR`` or ``FLAT_COLOR``.
Every shader defines a set of attributes and uniforms that have to be set in order to use the shader.
Attributes are properties that are set using a vertex buffer and can be different for individual vertices.
Uniforms are properties that are constant per draw call.
They can be set using the `shader.uniform_*` functions after the shader has been bound.
They can be set using the ``shader.uniform_*`` functions after the shader has been bound.
Batch Creation
++++++++++++++
@ -109,7 +109,7 @@ In Blender Offscreen Rendering is done using the :class:`gpu.types.GPUOffScreen`
.. warning::
`GPUOffScreen` objects are bound to the OpenGL context they have been created in.
:class:`gpu.types.GPUOffScreen` objects are bound to the OpenGL context they have been created in.
This means that once Blender discards this context (i.e. the window is closed),
the offscreen instance will be freed.

View file

@ -16,9 +16,9 @@ class ReleaseLogLine:
* issue_id: (int or None) the extracted issue id associated with this log
line. Can be None if the log line isn't associated with a issue.
* commit_id: (str or None) the extracted commit id associated with this log
line. Only filled when no `issue_id` could be found.
* ref: (str) `issue_id` or `commit_id` of this line, including `T` for issues
or `D` for diffs.
line. Only filled when no ``issue_id`` could be found.
* ref: (str) ``issue_id`` or ``commit_id`` of this line, including ``T`` for issues
or ``D`` for diffs.
* title: (str) title of this log line. When constructed this attribute is
an empty string. The called needs to retrieve the title from the
backend.

View file

@ -114,7 +114,7 @@ def def_prop_for_attribute(attr_name, type, default, doc):
def DefAttributeGetterSetters(attributes_list):
"""
A class decorator that reads a list of attribute information &
creates properties on the class with `getters` & `setters`.
creates properties on the class with ``getters`` & ``setters``.
"""
def wrapper(cls):
for prop_name, attr_name, type, default, doc in attributes_list:

View file

@ -73,7 +73,7 @@ def get_doc(obj):
def get_argspec(func, *, strip_self=True, doc=None, source=None):
"""Get argument specifications.
:arg strip_self: strip `self` from argspec
:arg strip_self: strip ``self`` from argspec
:type strip_self: bool
:arg doc: doc string of func (optional)
:type doc: str

View file

@ -1210,7 +1210,7 @@ class I18nMessages:
"""
Update or create a single PO file (specified by a filepath) from the given POT `I18nMessages` data.
Callback usable in a context where Blender specific modules (like `bpy`) are not available.
Callback usable in a context where Blender specific modules (like ``bpy``) are not available.
"""
import sys
sys.stdout.reconfigure(encoding="utf-8")
@ -1230,7 +1230,7 @@ class I18nMessages:
"""
Cleanup a single PO file (specified by a filepath).
Callback usable in a context where Blender specific modules (like `bpy`) are not available.
Callback usable in a context where Blender specific modules (like ``bpy``) are not available.
"""
import sys
sys.stdout.reconfigure(encoding="utf-8")
@ -1250,7 +1250,7 @@ class I18nMessages:
"""
Cleanup and write a single PO file (specified by a filepath) into the relevant Blender source 'compact' PO file.
Callback usable in a context where Blender specific modules (like `bpy`) are not available.
Callback usable in a context where Blender specific modules (like ``bpy``) are not available.
"""
import sys
sys.stdout.reconfigure(encoding="utf-8")

View file

@ -52,7 +52,7 @@ def load_image(
(based on file path).
:type check_existing: bool
:arg force_reload: If true,
force reloading of image (only useful when `check_existing`
force reloading of image (only useful when ``check_existing``
is also enabled).
:type force_reload: bool
:return: an image or None

View file

@ -29,7 +29,7 @@ class WM_OT_previews_batch_generate(Operator):
type=OperatorFileListElement,
options={'HIDDEN', 'SKIP_SAVE'},
name="",
description="Collection of file paths with common `directory` root",
description="Collection of file paths with common ``directory`` root",
)
directory: StringProperty(
@ -37,7 +37,7 @@ class WM_OT_previews_batch_generate(Operator):
subtype='FILE_PATH',
options={'HIDDEN', 'SKIP_SAVE'},
name="",
description="Root path of all files listed in `files` collection",
description="Root path of all files listed in ``files`` collection",
)
# Show only images/videos, and directories!

View file

@ -2149,7 +2149,7 @@ static void rna_def_ID_override_library(BlenderRNA *brna)
"view_layer",
"ViewLayer",
"",
"The view layer to operate in (same usage as the `scene` data, in case "
"The view layer to operate in (same usage as the ``scene`` data, in case "
"it is not provided the scene's collection will be used instead)");
parm = RNA_def_pointer(
func,

View file

@ -2031,8 +2031,8 @@ static void rna_def_armature_collections(BlenderRNA *brna, PropertyRNA *cprop)
"collections, which may not be in the order you expect. Root collections are listed first, "
"and siblings are always sequential. Apart from that, bone collections can be in any order, "
"and thus incrementing or decrementing this index can make the active bone collection jump "
"around in unexpected ways. For a more predictable interface, use `active` or "
"`active_name`.");
"around in unexpected ways. For a more predictable interface, use ``active`` or "
"``active_name``.");
RNA_def_property_int_funcs(prop,
"rna_BoneCollections_active_index_get",
"rna_BoneCollections_active_index_set",

View file

@ -377,8 +377,8 @@ static void rna_def_blendfile_import_item(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop,
"Imported ID",
"The imported ID. None until it has been linked or appended. May be "
"the same as `reusable_local_id` when appended");
"The imported ID. None until it has been linked or appended. "
"May be the same as ``reusable_local_id`` when appended");
RNA_def_property_pointer_funcs(
prop, "rna_BlendImportContextItem_id_get", nullptr, nullptr, nullptr);
@ -534,7 +534,7 @@ static void rna_def_blendfile_import_context(BlenderRNA *brna)
"DONE",
0,
"",
"All data has been imported and is available in the list of `import_items`"},
"All data has been imported and is available in the list of ``import_items``"},
{0, nullptr, 0, nullptr, nullptr},
};
prop = RNA_def_property(srna, "process_stage", PROP_ENUM, PROP_NONE);

View file

@ -2372,7 +2372,7 @@ void RNA_api_ui_layout(StructRNA *srna)
0,
"",
"Name of a custom operator to invoke when starting to drag an item. Never "
"invoked together with the `active_operator` (if set), it's either the drag or "
"invoked together with the ``active_operator`` (if set), it's either the drag or "
"the activate one");
parm = RNA_def_pointer(
func,
@ -2427,7 +2427,7 @@ void RNA_api_ui_layout(StructRNA *srna)
nullptr,
0,
"",
"Identifier of the asset shelf to display (`bl_idname`)");
"Identifier of the asset shelf to display (``bl_idname``)");
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
parm = RNA_def_string(
func, "name", nullptr, 0, "", "Optional name to indicate the active asset");

View file

@ -34,7 +34,7 @@ PyDoc_STRVAR(
/* Wrap. */
pygpu_doc,
"This module provides Python wrappers for the GPU implementation in Blender.\n"
"Some higher level functions can be found in the `gpu_extras` module.");
"Some higher level functions can be found in the :mod:`gpu_extras` module.");
static PyModuleDef pygpu_module_def = {
/*m_base*/ PyModuleDef_HEAD_INIT,
/*m_name*/ "gpu",

View file

@ -317,8 +317,8 @@ PyDoc_STRVAR(
pygpu_batch_draw_range_doc,
".. method:: draw_range(program, *, elem_start=0, elem_count=0)\n"
"\n"
" Run the drawing program with the parameters assigned to the batch. Only draw\n"
" the `elem_count` elements of the index buffer starting at `elem_start` \n"
" Run the drawing program with the parameters assigned to the batch. "
"Only draw the ``elem_count`` elements of the index buffer starting at ``elem_start``.\n"
"\n"
" :arg program: Program that performs the drawing operations.\n"
" :type program: :class:`gpu.types.GPUShader`\n"
@ -326,7 +326,7 @@ PyDoc_STRVAR(
" will start from the first element of the index buffer.\n"
" :type elem_start: int\n"
" :arg elem_count: Number of elements of the index buffer to draw. When not\n"
" provided or set to 0 all elements from `elem_start` to the end of the\n"
" provided or set to 0 all elements from ``elem_start`` to the end of the\n"
" index buffer will be drawn.\n"
" :type elem_count: int\n");
static PyObject *pygpu_batch_draw_range(BPyGPUBatch *self, PyObject *args, PyObject *kw)

View file

@ -247,7 +247,7 @@ PyDoc_STRVAR(
pygpu_interface_info_smooth_doc,
".. method:: smooth(type, name)\n"
"\n"
" Add an attribute with qualifier of type `smooth` to the interface block.\n"
" Add an attribute with qualifier of type *smooth* to the interface block.\n"
"\n"
" :arg type: One of these types:\n"
"\n" PYDOC_TYPE_LIST
@ -273,7 +273,7 @@ PyDoc_STRVAR(
pygpu_interface_info_flat_doc,
".. method:: flat(type, name)\n"
"\n"
" Add an attribute with qualifier of type `flat` to the interface block.\n"
" Add an attribute with qualifier of type ``flat`` to the interface block.\n"
"\n"
" :arg type: One of these types:\n"
"\n" PYDOC_TYPE_LIST
@ -299,7 +299,7 @@ PyDoc_STRVAR(
pygpu_interface_info_no_perspective_doc,
".. method:: no_perspective(type, name)\n"
"\n"
" Add an attribute with qualifier of type `no_perspective` to the interface block.\n"
" Add an attribute with qualifier of type ``no_perspective`` to the interface block.\n"
"\n"
" :arg type: One of these types:\n"
"\n" PYDOC_TYPE_LIST
@ -638,12 +638,14 @@ PyDoc_STRVAR(
pygpu_shader_info_uniform_buf_doc,
".. method:: uniform_buf(slot, type_name, name)\n"
"\n"
" Specify a uniform variable whose type can be one of those declared in `typedef_source`.\n"
" Specify a uniform variable whose type can be one of those declared in "
":meth:`gpu.types.GPUShaderCreateInfo.typedef_source`.\n"
"\n"
" :arg slot: The uniform variable index.\n"
" :type slot: int\n"
" :arg type_name: Name of the data type. It can be a struct type defined in the source "
"passed through the :meth:`gpu.types.GPUShaderCreateInfo.typedef_source`.\n"
" :arg type_name: Name of the data type. "
"It can be a struct type defined in the source passed through the "
":meth:`gpu.types.GPUShaderCreateInfo.typedef_source`.\n"
" :type type_name: str\n"
" :arg name: The uniform variable name.\n"
" :type name: str\n");

View file

@ -452,7 +452,7 @@ PyDoc_STRVAR(
".. function:: unescape_identifier(string)\n"
"\n"
" Simple string un-escape function used for animation paths.\n"
" This performs the reverse of `escape_identifier`.\n"
" This performs the reverse of :func:`escape_identifier`.\n"
"\n"
" :arg string: text\n"
" :type string: str\n"

View file

@ -9,7 +9,7 @@ def set_view3d_context_override(context_override):
"""
Set context override to become the first viewport in the active workspace
The `context_override` is expected to be a copy of an actual current context
The ``context_override`` is expected to be a copy of an actual current context
obtained by `context.copy()`
"""

View file

@ -542,7 +542,7 @@ class InvisibleObjectExportTest(AbstractAlembicTest):
This test only tests a small subset of the functionality that is required to
export invisible objects. It just tests that the visibility property is
written, and that it has the correct initial value. This is a limitation
caused by these tests relying on `abcls`.
caused by these tests relying on ``abcls``.
"""
@with_tempdir

View file

@ -21,7 +21,7 @@ id_type = bpy.types.Scene
def seq_items_xform(data, xform_fn):
"""
Recursively expand items using `xform_fn`.
Recursively expand items using ``xform_fn``.
"""
if hasattr(data, "__len__"):
return tuple(seq_items_xform(v, xform_fn) for v in data)

View file

@ -112,7 +112,7 @@ class UnitTesting(ViewLayerTesting):
def test_scene_read_collections(self):
"""
See if read is working for scene collections
(run `test_scene_write_colections` first)
(run ``test_scene_write_colections`` first).
"""
import os
@ -129,7 +129,7 @@ class UnitTesting(ViewLayerTesting):
def test_scene_read_layers(self):
"""
See if read is working for scene layers
(run `test_scene_write_layers` first)
(run ``test_scene_write_layers`` first).
"""
import os

View file

@ -131,7 +131,7 @@ def find_main_area(ui_type=None):
def gen_events_type_text(text):
"""
Generate events to type in `text`.
Generate events to type in ``text``.
"""
for ch in text:
kw_extra = {}

View file

@ -469,7 +469,7 @@ class edit_generators:
class sizeof_fixed_array(EditGenerator):
"""
Use fixed size array syntax with `sizeof`:
Use fixed size array syntax with ``sizeof``:
Replace:
sizeof(float) * 4 * 4
@ -934,7 +934,7 @@ class edit_generators:
class use_const_vars(EditGenerator):
"""
Use `const` where possible:
Use ``const`` where possible:
Replace:
float abc[3] = {0, 1, 2};
@ -1662,7 +1662,7 @@ def test_edit(
verbose_edit_actions: bool,
) -> bool:
"""
Return true if `data_test` has the same object output as `data`.
Return true if ``data_test`` has the same object output as ``data``.
"""
if os.path.exists(output):
os.remove(output)