Cleanup utils

Just a tiny simplification, found by pylint.
This commit is contained in:
Grigori Goronzy 2017-10-11 01:13:24 +02:00
parent b145fb364a
commit fd923f3a92

View File

@ -29,14 +29,12 @@ class Utils:
def to_bool(cls, val): def to_bool(cls, val):
"""make sensible boolean from string or other type value""" """make sensible boolean from string or other type value"""
if val is None: if not val:
return False return False
if isinstance(val, bool): if isinstance(val, bool):
return val return val
elif isinstance(val, int): elif isinstance(val, int):
return bool(val) return bool(val)
elif len(val) == 0:
return False
else: else:
return True if val[0].lower() == "t" or val[0] == "1" else False return True if val[0].lower() == "t" or val[0] == "1" else False