Cleanup: consistent doc-string comment block style

Mixing different newline style with doc-strings is error prone.
This commit is contained in:
Campbell Barton
2025-08-12 12:02:08 +10:00
parent d2cbb42937
commit eb57af250c

View File

@@ -239,7 +239,8 @@ class Object(_types.ID):
:type: tuple of :class:`Object`
.. note:: Takes ``O(len(bpy.data.objects))`` time."""
.. note:: Takes ``O(len(bpy.data.objects))`` time.
"""
import bpy
return tuple(
child for child in bpy.data.objects
@@ -253,7 +254,8 @@ class Object(_types.ID):
:type: list of :class:`Object`
.. note:: Takes ``O(len(bpy.data.objects))`` time."""
.. note:: Takes ``O(len(bpy.data.objects))`` time.
"""
import bpy
parent_child_map = {}
for child in bpy.data.objects:
@@ -277,7 +279,8 @@ class Object(_types.ID):
:type: tuple of :class:`Collection`
.. note:: Takes ``O(len(bpy.data.collections) + len(bpy.data.scenes))`` time."""
.. note:: Takes ``O(len(bpy.data.collections) + len(bpy.data.scenes))`` time.
"""
import bpy
return (
tuple(
@@ -296,7 +299,8 @@ class Object(_types.ID):
:type: tuple of :class:`Scene`
.. note:: Takes ``O(len(bpy.data.scenes) * len(bpy.data.objects))`` time."""
.. note:: Takes ``O(len(bpy.data.scenes) * len(bpy.data.objects))`` time.
"""
import bpy
return tuple(
scene for scene in bpy.data.scenes
@@ -392,7 +396,9 @@ class _GenericBone:
__slots__ = ()
def translate(self, vec):
"""Utility function to add *vec* to the head and tail of this bone"""
"""
Utility function to add *vec* to the head and tail of this bone.
"""
self.head += vec
self.tail += vec
@@ -416,34 +422,41 @@ class _GenericBone:
@property
def x_axis(self):
""" Vector pointing down the x-axis of the bone.
"""
Vector pointing down the x-axis of the bone.
"""
from mathutils import Vector
return self.matrix.to_3x3() @ Vector((1.0, 0.0, 0.0))
@property
def y_axis(self):
""" Vector pointing down the y-axis of the bone.
"""
Vector pointing down the y-axis of the bone.
"""
from mathutils import Vector
return self.matrix.to_3x3() @ Vector((0.0, 1.0, 0.0))
@property
def z_axis(self):
""" Vector pointing down the z-axis of the bone.
"""
Vector pointing down the z-axis of the bone.
"""
from mathutils import Vector
return self.matrix.to_3x3() @ Vector((0.0, 0.0, 1.0))
@property
def basename(self):
"""The name of this bone before any '.' character"""
"""
The name of this bone before any ``.`` character.
"""
# return self.name.rsplit(".", 1)[0]
return self.name.split(".")[0]
@property
def parent_recursive(self):
"""A list of parents, starting with the immediate parent"""
"""
A list of parents, starting with the immediate parent.
"""
parent_list = []
parent = self.parent
@@ -457,7 +470,9 @@ class _GenericBone:
@property
def center(self):
"""The midpoint between the head and the tail."""
"""
The midpoint between the head and the tail.
"""
return (self.head + self.tail) * 0.5
@property
@@ -559,9 +574,11 @@ class EditBone(_StructRNA, _GenericBone, metaclass=_StructMetaPropGroup):
@property
def children(self):
"""A list of all the bones children.
"""
A list of all the bones children.
.. note:: Takes ``O(len(bones))`` time."""
.. note:: Takes ``O(len(bones))`` time.
"""
return [child for child in self._other_bones if child.parent == self]
def align_orientation(self, other):
@@ -608,7 +625,9 @@ class BoneCollection(_StructRNA, metaclass=_StructMetaPropGroup):
@property
def bones_recursive(self):
"""A set of all bones assigned to this bone collection and its child collections."""
"""
A set of all bones assigned to this bone collection and its child collections.
"""
bones = set()
collections = [self]
@@ -801,7 +820,9 @@ class MeshLoopTriangle(_StructRNA):
@property
def center(self):
"""The midpoint of the face."""
"""
The midpoint of the face.
"""
face_verts = self.vertices[:]
mesh_verts = self.id_data.vertices
return (
@@ -862,7 +883,9 @@ class Sound(_types.ID):
@property
def factory(self):
"""The aud.Factory object of the sound."""
"""
The aud.Factory object of the sound.
"""
import aud
return aud._sound_from_pointer(self.as_pointer())
@@ -1016,7 +1039,9 @@ class Operator(_StructRNA, metaclass=_RNAMeta):
return super().__delattr__(attr)
def as_keywords(self, *, ignore=()):
"""Return a copy of the properties as a dictionary"""
"""
Return a copy of the properties as a dictionary.
"""
ignore = ignore + ("rna_type",)
return {
attr: getattr(self, attr)
@@ -1148,7 +1173,9 @@ class _GenericUI:
@classmethod
def remove(cls, draw_func):
"""Remove a draw function that has been added to this menu"""
"""
Remove a draw function that has been added to this menu.
"""
draw_funcs = cls._dyn_ui_initialize()
try:
draw_funcs.remove(draw_func)
@@ -1342,7 +1369,8 @@ class NodeSocket(_StructRNA, metaclass=_RNAMetaPropGroup):
:type: :class:`NodeLinks`
.. note:: Takes ``O(len(nodetree.links))`` time."""
.. note:: Takes ``O(len(nodetree.links))`` time.
"""
links = (link for link in self.id_data.links
if self in (link.from_socket, link.to_socket))