From c3b067dc80f7c59fd0aa8252033bfddf2ca8f753 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 16 Oct 2024 14:45:08 +1100 Subject: [PATCH] Cleanup: single/double quote use in scripts --- scripts/modules/blend_render_info.py | 2 +- scripts/modules/graphviz_export.py | 4 ++-- scripts/startup/bl_operators/node.py | 6 +++--- scripts/startup/bl_ui/properties_data_armature.py | 2 +- scripts/startup/bl_ui/space_properties.py | 2 +- scripts/startup/bl_ui/space_userpref.py | 8 ++++---- scripts/startup/bl_ui/space_view3d.py | 14 ++++++++------ scripts/templates_py/background_job.py | 4 ++-- scripts/templates_py/gizmo_custom_geometry.py | 2 +- scripts/templates_py/gizmo_simple.py | 2 +- tools/utils_maintenance/blender_update_themes.py | 4 ++-- 11 files changed, 26 insertions(+), 24 deletions(-) diff --git a/scripts/modules/blend_render_info.py b/scripts/modules/blend_render_info.py index 506caf4cfde..65e8bf55eb1 100755 --- a/scripts/modules/blend_render_info.py +++ b/scripts/modules/blend_render_info.py @@ -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)) diff --git a/scripts/modules/graphviz_export.py b/scripts/modules/graphviz_export.py index e6b3168ac11..5ab7b685d36 100644 --- a/scripts/modules/graphviz_export.py +++ b/scripts/modules/graphviz_export.py @@ -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 diff --git a/scripts/startup/bl_operators/node.py b/scripts/startup/bl_operators/node.py index 0d8590572e0..6e3e8c0de9c 100644 --- a/scripts/startup/bl_operators/node.py +++ b/scripts/startup/bl_operators/node.py @@ -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'} diff --git a/scripts/startup/bl_ui/properties_data_armature.py b/scripts/startup/bl_ui/properties_data_armature.py index c1a3c013a03..614d3ed50c6 100644 --- a/scripts/startup/bl_ui/properties_data_armature.py +++ b/scripts/startup/bl_ui/properties_data_armature.py @@ -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): diff --git a/scripts/startup/bl_ui/space_properties.py b/scripts/startup/bl_ui/space_properties.py index 34fc114d470..c69f8375fae 100644 --- a/scripts/startup/bl_ui/space_properties.py +++ b/scripts/startup/bl_ui/space_properties.py @@ -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") diff --git a/scripts/startup/bl_ui/space_userpref.py b/scripts/startup/bl_ui/space_userpref.py index 86839c3afcc..382700f2dbe 100644 --- a/scripts/startup/bl_ui/space_userpref.py +++ b/scripts/startup/bl_ui/space_userpref.py @@ -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): diff --git a/scripts/startup/bl_ui/space_view3d.py b/scripts/startup/bl_ui/space_view3d.py index 66a32914969..aea6ec38aa9 100644 --- a/scripts/startup/bl_ui/space_view3d.py +++ b/scripts/startup/bl_ui/space_view3d.py @@ -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") diff --git a/scripts/templates_py/background_job.py b/scripts/templates_py/background_job.py index e93ca2d8c6f..75027e8d204 100644 --- a/scripts/templates_py/background_job.py +++ b/scripts/templates_py/background_job.py @@ -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. diff --git a/scripts/templates_py/gizmo_custom_geometry.py b/scripts/templates_py/gizmo_custom_geometry.py index f0fe9015d9e..1db74cd19df 100644 --- a/scripts/templates_py/gizmo_custom_geometry.py +++ b/scripts/templates_py/gizmo_custom_geometry.py @@ -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") diff --git a/scripts/templates_py/gizmo_simple.py b/scripts/templates_py/gizmo_simple.py index d222e8b49d7..1608a7bcd0d 100644 --- a/scripts/templates_py/gizmo_simple.py +++ b/scripts/templates_py/gizmo_simple.py @@ -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") diff --git a/tools/utils_maintenance/blender_update_themes.py b/tools/utils_maintenance/blender_update_themes.py index c4d7a139258..371307a4a09 100644 --- a/tools/utils_maintenance/blender_update_themes.py +++ b/tools/utils_maintenance/blender_update_themes.py @@ -34,13 +34,13 @@ def update(filepath): def update_default(filepath): with open(filepath, 'w', encoding='utf-8') as fh: - fh.write(''' + fh.write(""" -''') +""") def main():