Method is_valid_boolstr is currently doing 8 different checks against
the same variable. This patch refactors this method to be more pythonic
by using the in operator.
Change-Id: If77c3a80a5698685aa67120bcee2e223584f5d16
def is_valid_boolstr(val):
"""Check if the provided string is a valid bool string or not."""
val = str(val).lower()
- return (val == 'true' or val == 'false' or
- val == 'yes' or val == 'no' or
- val == 'y' or val == 'n' or
- val == '1' or val == '0')
+ return val in ('true', 'false', 'yes', 'no', 'y', 'n', '1', '0')
def is_none_string(val):