Cleanup: isinstance can take multiple types

This commit is contained in:
Campbell Barton
2018-07-07 11:27:48 +02:00
parent 4b373ed086
commit 97cd8bfae1
2 changed files with 3 additions and 3 deletions

View 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)