Refactor cinder.utils.is_valid_boolstr
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
This commit is contained in:
parent
a4e7656620
commit
e59df24809
@ -342,10 +342,7 @@ def safe_minidom_parse_string(xml_string):
|
||||
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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user