Cleanup: isinstance can take multiple types
authorCampbell Barton <ideasman42@gmail.com>
Sat, 7 Jul 2018 09:27:48 +0000 (11:27 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 7 Jul 2018 09:29:57 +0000 (11:29 +0200)
release/scripts/modules/bpy_extras/keyconfig_utils.py
release/scripts/startup/bl_ui/properties_texture.py

index 92674bfc5f66bbb1e00930353def02cd25469104..3a9570a57c4692c7d924e17d6bb0f284407045d3 100644 (file)
@@ -240,9 +240,9 @@ def _export_properties(prefix, properties, kmi_id, lines=None):
         lines = []
 
     def string_value(value):
-        if isinstance(value, str) or isinstance(value, bool) or isinstance(value, float) or isinstance(value, int):
+        if isinstance(value, (str, bool, float, int)):
             return repr(value)
-        elif getattr(value, '__len__', False):
+        elif hasattr(value, "__len__"):
             return repr(list(value))
 
         print("Export key configuration: can't write ", value)
index 7da347823640edaa51e5002791f5c5faa2a1060f..018f3df6f0ddc63cf9b9cfe9d474ac3f59cf7c12 100644 (file)
@@ -1203,7 +1203,7 @@ class TEXTURE_PT_influence(TextureSlotPanel, Panel):
             col.prop(tex, "invert", text="Negative")
             col.prop(tex, "use_stencil")
 
-        if isinstance(idblock, Material) or isinstance(idblock, World):
+        if isinstance(idblock, (Material, World)):
             col.prop(tex, "default_value", text="DVar", slider=True)
 
         if isinstance(idblock, Material):