Cleanup: single/double quote use in scripts

This commit is contained in:
Campbell Barton 2024-10-16 14:45:08 +11:00
parent 7ae7592899
commit c3b067dc80
11 changed files with 26 additions and 24 deletions

View File

@ -116,7 +116,7 @@ def _read_blend_rend_chunk_from_file(blendfile, filepath):
scene_name = scene_name[:scene_name.index(b'\0')]
# It's possible old blend files are not UTF8 compliant, use `surrogateescape`.
scene_name = scene_name.decode("utf8", errors='surrogateescape')
scene_name = scene_name.decode("utf8", errors="surrogateescape")
scenes.append((start_frame, end_frame, scene_name))

View File

@ -27,8 +27,8 @@ def compat_str(text, line_length=0):
text_ls.append(text)
text = '\n '.join(text_ls)
# text = text.replace('.', '.\n')
# text = text.replace(']', ']\n')
# text = text.replace(".", ".\n")
# text = text.replace("]", "]\n")
text = text.replace("\n", "\\n")
text = text.replace('"', '\\"')
return text

View File

@ -295,7 +295,7 @@ class NodeInterfaceOperator():
class NODE_OT_interface_item_new(NodeInterfaceOperator, Operator):
'''Add a new item to the interface'''
"""Add a new item to the interface"""
bl_idname = "node.interface_item_new"
bl_label = "New Item"
bl_options = {'REGISTER', 'UNDO'}
@ -361,7 +361,7 @@ class NODE_OT_interface_item_new(NodeInterfaceOperator, Operator):
class NODE_OT_interface_item_duplicate(NodeInterfaceOperator, Operator):
'''Add a copy of the active item to the interface'''
"""Add a copy of the active item to the interface"""
bl_idname = "node.interface_item_duplicate"
bl_label = "Duplicate Item"
bl_options = {'REGISTER', 'UNDO'}
@ -390,7 +390,7 @@ class NODE_OT_interface_item_duplicate(NodeInterfaceOperator, Operator):
class NODE_OT_interface_item_remove(NodeInterfaceOperator, Operator):
'''Remove active item from the interface'''
"""Remove active item from the interface"""
bl_idname = "node.interface_item_remove"
bl_label = "Remove Item"
bl_options = {'REGISTER', 'UNDO'}

View File

@ -398,7 +398,7 @@ class POSE_MT_selection_set_create(Menu):
class POSE_MT_selection_sets_select(Menu):
bl_label = 'Select Selection Set'
bl_label = "Select Selection Set"
@classmethod
def poll(cls, context):

View File

@ -119,7 +119,7 @@ class PropertiesAnimationMixin:
class_list = [c.__name__ for c in cls.mro()]
print("PropertiesAnimationMixin: no animatable data-block, this is a bug "
"in one of these classes: {!r}".format(class_list))
layout.label(text='No animatable data-block, please report as bug', icon='ERROR')
layout.label(text="No animatable data-block, please report as bug", icon='ERROR')
return
layout.template_action(animated_id, new="action.new", unlink="action.unlink")

View File

@ -694,7 +694,7 @@ class USERPREF_PT_system_display_graphics(SystemPanel, CenterAlignMixIn, Panel):
import gpu
if system.gpu_backend != gpu.platform.backend_type_get():
layout.label(text="A restart of Blender is required", icon="INFO")
layout.label(text="A restart of Blender is required", icon='INFO')
if system.gpu_backend == gpu.platform.backend_type_get() == 'VULKAN':
col = layout.column()
@ -702,9 +702,9 @@ class USERPREF_PT_system_display_graphics(SystemPanel, CenterAlignMixIn, Panel):
if system.gpu_backend == 'VULKAN':
col = layout.column()
col.label(text="The Vulkan backend is experimental:", icon="INFO")
col.label(text="\u2022 OpenXR and GPU subdivision are not supported", icon="BLANK1")
col.label(text="\u2022 Expect reduced performance", icon="BLANK1")
col.label(text="The Vulkan backend is experimental:", icon='INFO')
col.label(text="\u2022 OpenXR and GPU subdivision are not supported", icon='BLANK1')
col.label(text="\u2022 Expect reduced performance", icon='BLANK1')
class USERPREF_PT_system_os_settings(SystemPanel, CenterAlignMixIn, Panel):

View File

@ -979,7 +979,7 @@ class VIEW3D_HT_header(Header):
layout.popover(
panel="VIEW3D_PT_sculpt_snapping",
icon="SNAP_INCREMENT",
icon='SNAP_INCREMENT',
text="",
translate=False,
)
@ -1001,7 +1001,7 @@ class VIEW3D_HT_header(Header):
layout.popover(
panel="VIEW3D_PT_sculpt_snapping",
icon="SNAP_INCREMENT",
icon='SNAP_INCREMENT',
text="",
translate=False,
)
@ -1366,9 +1366,11 @@ class VIEW3D_MT_mirror(Menu):
for (space_name, space_id) in (("Global", 'GLOBAL'), ("Local", 'LOCAL')):
for axis_index, axis_name in enumerate("XYZ"):
props = layout.operator("transform.mirror",
text="{:s} {:s}".format(axis_name, iface_(space_name)),
translate=False)
props = layout.operator(
"transform.mirror",
text="{:s} {:s}".format(axis_name, iface_(space_name)),
translate=False,
)
props.constraint_axis[axis_index] = True
props.orient_type = space_id
@ -1765,7 +1767,7 @@ class VIEW3D_MT_select_pose(Menu):
layout.separator()
layout.menu('POSE_MT_selection_sets_select', text="Bone Selection Set")
layout.menu("POSE_MT_selection_sets_select", text="Bone Selection Set")
layout.operator("pose.select_constraint_target", text="Constraint Target")

View File

@ -10,10 +10,10 @@
# --save="/tmp/hello.blend"
#
# Notice:
# '--factory-startup' is used to avoid the user default settings from
# `--factory-startup` is used to avoid the user default settings from
# interfering with automated scene generation.
#
# '--' causes blender to ignore all following arguments so python can use them.
# `--` causes blender to ignore all following arguments so python can use them.
#
# See blender --help for details.

View File

@ -125,7 +125,7 @@ class MyCustomShapeWidgetGroup(GizmoGroup):
return (ob and ob.type == 'LIGHT')
def setup(self, context):
# Assign the 'offset' target property to the light energy.
# Assign the `offset` target property to the light energy.
ob = context.object
gz = self.gizmos.new(MyCustomShapeWidget.bl_idname)
gz.target_set_prop("offset", ob.data, "energy")

View File

@ -23,7 +23,7 @@ class MyLightWidgetGroup(GizmoGroup):
return (ob and ob.type == 'LIGHT')
def setup(self, context):
# Arrow gizmo has one 'offset' property we can assign to the light energy.
# Arrow gizmo has one `offset` property we can assign to the light energy.
ob = context.object
gz = self.gizmos.new("GIZMO_GT_arrow_3d")
gz.target_set_prop("offset", ob.data, "energy")

View File

@ -34,13 +34,13 @@ def update(filepath):
def update_default(filepath):
with open(filepath, 'w', encoding='utf-8') as fh:
fh.write('''<bpy>
fh.write("""<bpy>
<Theme>
</Theme>
<ThemeStyle>
</ThemeStyle>
</bpy>
''')
""")
def main():