refactor: Pep8 recommendations

pull/372/head
Rodrigo Cristiano 2021-12-22 14:41:18 -03:00
parent e9ca00574e
commit 643bc357fc
1 changed files with 5 additions and 5 deletions

View File

@ -415,12 +415,12 @@ def strtobool(val: str) -> bool:
""" """
try: try:
val = val.lower() val = val.lower()
except AttributeError:
raise ValueError(f"invalid type {type(val)} for truth value {val}")
if val in ('y', 'yes', 't', 'true', 'on', '1'): if val in ('y', 'yes', 't', 'true', 'on', '1'):
return True return True
elif val in ('n', 'no', 'f', 'false', 'off', '0'): elif val in ('n', 'no', 'f', 'false', 'off', '0'):
return False return False
except:
raise ValueError(f"invalid type {type(val)} for truth value {val}")
else: else:
raise ValueError(f"invalid truth value {val}") raise ValueError(f"invalid truth value {val}")