[bugfix] re-implement ability of get_bool to return unidentifiable input

This commit is contained in:
Marcel Paffrath 2024-06-07 13:07:42 +02:00 committed by Sebastian Wehling-Benatelli
parent e3dd4a4e28
commit 0fb0b0f11c

View File

@ -333,7 +333,7 @@ def get_none(value):
def get_bool(value):
"""
Convert string representations of bools to their true boolean value
Convert string representations of bools to their true boolean value. Return value if it cannot be identified as bool.
:param value:
:type value: str, bool, int, float
:return: true boolean value
@ -355,6 +355,8 @@ def get_bool(value):
False
>>> get_bool(-0.3)
False
>>> get_bool(None)
None
"""
if type(value) == bool:
return value
@ -362,10 +364,13 @@ def get_bool(value):
return True
elif value in ['False', 'false']:
return False
elif value > 0. or value > 0:
return True
elif isinstance(value, float) or isinstance(value, int):
if value > 0. or value > 0:
return True
else:
return False
else:
return False
return value
def four_digits(year):