[Bf-blender-cvs] [be8270bc76e] master: Cleanup: use equality instead of contains for single-item sets

Campbell Barton noreply at git.blender.org
Wed Mar 30 02:41:55 CEST 2022


Commit: be8270bc76ef873adb646b97abcf925beae90137
Author: Campbell Barton
Date:   Wed Mar 30 11:27:54 2022 +1100
Branches: master
https://developer.blender.org/rBbe8270bc76ef873adb646b97abcf925beae90137

Cleanup: use equality instead of contains for single-item sets

===================================================================

M	doc/python_api/examples/bpy.types.UIList.1.py
M	doc/python_api/examples/bpy.types.UIList.2.py
M	release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M	release/scripts/startup/bl_ui/properties_physics_fluid.py
M	release/scripts/startup/bl_ui/space_outliner.py
M	release/scripts/startup/bl_ui/space_view3d.py
M	release/scripts/templates_py/ui_list.py
M	release/scripts/templates_py/ui_list_simple.py

===================================================================

diff --git a/doc/python_api/examples/bpy.types.UIList.1.py b/doc/python_api/examples/bpy.types.UIList.1.py
index a8b1cfa85a5..2b2a0d90c3b 100644
--- a/doc/python_api/examples/bpy.types.UIList.1.py
+++ b/doc/python_api/examples/bpy.types.UIList.1.py
@@ -41,7 +41,7 @@ class MATERIAL_UL_matslots_example(bpy.types.UIList):
             else:
                 layout.label(text="", translate=False, icon_value=icon)
         # 'GRID' layout type should be as compact as possible (typically a single icon!).
-        elif self.layout_type in {'GRID'}:
+        elif self.layout_type == 'GRID':
             layout.alignment = 'CENTER'
             layout.label(text="", icon_value=icon)
 
diff --git a/doc/python_api/examples/bpy.types.UIList.2.py b/doc/python_api/examples/bpy.types.UIList.2.py
index 5f3ecbf116c..05c9e9b3a17 100644
--- a/doc/python_api/examples/bpy.types.UIList.2.py
+++ b/doc/python_api/examples/bpy.types.UIList.2.py
@@ -73,7 +73,7 @@ class MESH_UL_vgroups_slow(bpy.types.UIList):
                 layout.prop(vgroup, "name", text="", emboss=False, icon_value=icon)
             icon = 'LOCKED' if vgroup.lock_weight else 'UNLOCKED'
             layout.prop(vgroup, "lock_weight", text="", icon=icon, emboss=False)
-        elif self.layout_type in {'GRID'}:
+        elif self.layout_type == 'GRID':
             layout.alignment = 'CENTER'
             if flt_flag & self.VGROUP_EMPTY:
                 layout.enabled = False
diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index d5a9887f551..481753d5e79 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -362,7 +362,7 @@ class GPENCIL_UL_annotation_layer(UIList):
 
             row = layout.row(align=True)
 
-            icon_xray = "XRAY" if gpl.show_in_front else "FACESEL"
+            icon_xray = 'XRAY' if gpl.show_in_front else 'FACESEL'
             row.prop(gpl, "show_in_front", text="", icon=icon_xray, emboss=False)
 
             row.prop(gpl, "annotation_hide", text="", emboss=False)
diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py
index 0e8e452c717..f8dea120db3 100644
--- a/release/scripts/startup/bl_ui/properties_physics_fluid.py
+++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py
@@ -55,7 +55,7 @@ class PhysicButtonsPanel:
         md = context.fluid
         if md and (md.fluid_type == 'DOMAIN'):
             domain = md.domain_settings
-            return domain.domain_type in {'GAS'}
+            return domain.domain_type == 'GAS'
         return False
 
     @staticmethod
@@ -66,7 +66,7 @@ class PhysicButtonsPanel:
         md = context.fluid
         if md and (md.fluid_type == 'DOMAIN'):
             domain = md.domain_settings
-            return domain.domain_type in {'LIQUID'}
+            return domain.domain_type == 'LIQUID'
         return False
 
     @staticmethod
@@ -812,7 +812,7 @@ class PHYSICS_PT_mesh(PhysicButtonsPanel, Panel):
         col.separator()
         col.prop(domain, "mesh_generator", text="Mesh Generator")
 
-        if domain.mesh_generator in {'IMPROVED'}:
+        if domain.mesh_generator == 'IMPROVED':
             col = flow.column(align=True)
             col.prop(domain, "mesh_smoothen_pos", text="Smoothing Positive")
             col.prop(domain, "mesh_smoothen_neg", text="Negative")
@@ -1227,7 +1227,7 @@ class PHYSICS_PT_cache(PhysicButtonsPanel, Panel):
         row.enabled = not is_baking_any and not has_baked_data
         row.prop(domain, "cache_data_format", text="Format Volumes")
 
-        if md.domain_settings.domain_type in {'LIQUID'} and domain.use_mesh:
+        if md.domain_settings.domain_type == 'LIQUID' and domain.use_mesh:
             row = col.row()
             row.enabled = not is_baking_any and not has_baked_mesh
             row.prop(domain, "cache_mesh_format", text="Meshes")
diff --git a/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py
index bbe165b9286..0f3dc1f8794 100644
--- a/release/scripts/startup/bl_ui/space_outliner.py
+++ b/release/scripts/startup/bl_ui/space_outliner.py
@@ -351,7 +351,7 @@ class OUTLINER_PT_filter(Panel):
             col = layout.column(align=True)
             col.prop(space, "use_sort_alpha")
 
-        if display_mode not in {'LIBRARY_OVERRIDES'}:
+        if display_mode != 'LIBRARY_OVERRIDES':
             row = layout.row(align=True)
             row.prop(space, "use_sync_select", text="Sync Selection")
 
@@ -364,13 +364,13 @@ class OUTLINER_PT_filter(Panel):
         col.prop(space, "use_filter_complete", text="Exact Match")
         col.prop(space, "use_filter_case_sensitive", text="Case Sensitive")
 
-        if display_mode in {'LIBRARY_OVERRIDES'} and bpy.data.libraries:
+        if display_mode == 'LIBRARY_OVERRIDES' and bpy.data.libraries:
             col.separator()
             row = col.row()
             row.label(icon='LIBRARY_DATA_OVERRIDE')
             row.prop(space, "use_filter_lib_override_system", text="System Overrides")
 
-        if display_mode not in {'VIEW_LAYER'}:
+        if display_mode != 'VIEW_LAYER':
             return
 
         layout.separator()
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 1c42bc85fae..e78ea9d7fc1 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -5301,7 +5301,7 @@ class VIEW3D_MT_pivot_pie(Menu):
         pie.prop_enum(context.scene.tool_settings, "transform_pivot_point", value='ACTIVE_ELEMENT')
         if (obj is None) or (mode in {'OBJECT', 'POSE', 'WEIGHT_PAINT'}):
             pie.prop(context.scene.tool_settings, "use_transform_pivot_point_align")
-        if mode in {'EDIT_GPENCIL'}:
+        if mode == 'EDIT_GPENCIL':
             pie.prop(context.scene.tool_settings.gpencil_sculpt, "use_scale_thickness")
 
 
diff --git a/release/scripts/templates_py/ui_list.py b/release/scripts/templates_py/ui_list.py
index f6b82356a78..9727a1b3678 100644
--- a/release/scripts/templates_py/ui_list.py
+++ b/release/scripts/templates_py/ui_list.py
@@ -18,7 +18,7 @@ class MESH_UL_mylist(bpy.types.UIList):
         if self.layout_type in {'DEFAULT', 'COMPACT'}:
             pass
         # 'GRID' layout type should be as compact as possible (typically a single icon!).
-        elif self.layout_type in {'GRID'}:
+        elif self.layout_type == 'GRID':
             pass
 
     # Called once to draw filtering/reordering options.
diff --git a/release/scripts/templates_py/ui_list_simple.py b/release/scripts/templates_py/ui_list_simple.py
index ac3f2b984de..c3efe16058a 100644
--- a/release/scripts/templates_py/ui_list_simple.py
+++ b/release/scripts/templates_py/ui_list_simple.py
@@ -29,7 +29,7 @@ class MATERIAL_UL_matslots_example(bpy.types.UIList):
             else:
                 layout.label(text="", translate=False, icon_value=icon)
         # 'GRID' layout type should be as compact as possible (typically a single icon!).
-        elif self.layout_type in {'GRID'}:
+        elif self.layout_type == 'GRID':
             layout.alignment = 'CENTER'
             layout.label(text="", icon_value=icon)



More information about the Bf-blender-cvs mailing list