Cleanup: redundant len() checks
authorCampbell Barton <ideasman42@gmail.com>
Mon, 15 Oct 2018 21:50:35 +0000 (08:50 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 15 Oct 2018 21:52:46 +0000 (08:52 +1100)
release/scripts/startup/bl_operators/wm.py
release/scripts/startup/bl_ui/properties_data_armature.py
release/scripts/startup/bl_ui/space_view3d_toolbar.py

index 4fcadbf63e3a44cb6ad81930a588d98abe3eb507..260afd39b65a6bb7590eb3542f24c53bbe5b1973 100644 (file)
@@ -2521,11 +2521,11 @@ class WM_OT_studiolight_uninstall(Operator):
         userpref = context.user_preferences
         for studio_light in userpref.studio_lights:
             if studio_light.index == self.index:
-                if len(studio_light.path) > 0:
+                if studio_light.path:
                     self._remove_path(pathlib.Path(studio_light.path))
-                if len(studio_light.path_irr_cache) > 0:
+                if studio_light.path_irr_cache:
                     self._remove_path(pathlib.Path(studio_light.path_irr_cache))
-                if len(studio_light.path_sh_cache) > 0:
+                if studio_light.path_sh_cache:
                     self._remove_path(pathlib.Path(studio_light.path_sh_cache))
                 userpref.studio_lights.remove(studio_light)
                 return {'FINISHED'}
index 376f2d9811d157c5bb6cd531b6792d03b18c0d95..f41036db5a5ff20c56fb5ce5a7093083102ce95c 100644 (file)
@@ -173,7 +173,7 @@ class DATA_PT_pose_library(ArmatureButtonsPanel, Panel):
 
         if poselib:
             # warning about poselib being in an invalid state
-            if len(poselib.fcurves) > 0 and len(poselib.pose_markers) == 0:
+            if poselib.fcurves and not poselib.pose_markers:
                 layout.label(icon='ERROR', text="Error: Potentially corrupt library, run 'Sanitize' operator to fix")
 
             # list of poses in pose library
@@ -344,7 +344,7 @@ class DATA_PT_onion_skinning(OnionSkinButtonsPanel):  # , Panel): # inherit from
     @classmethod
     def poll(cls, context):
         # XXX: include pose-mode check?
-        return (context.object) and (context.armature)
+        return context.object and context.armature
 
     def draw(self, context):
         ob = context.object
index 8e06a811c5ee8469099b30c7558b6d7d8bd6d093..6cc0e6f46d4e13fab231e3595458b18492086ae0 100644 (file)
@@ -509,7 +509,7 @@ class VIEW3D_PT_slots_projectpaint(View3DPanel, Panel):
                                      ob, "material_slots",
                                      ob, "active_material_index", rows=2)
             mat = ob.active_material
-            if mat and len(mat.texture_paint_images) > 0:
+            if mat and mat.texture_paint_images:
                 row = layout.row()
                 row.template_list("TEXTURE_UL_texpaintslots", "",
                                   mat, "texture_paint_images",