mirror of
https://github.com/bringout/oca-storage.git
synced 2026-04-18 03:52:05 +02:00
21 lines
389 B
Python
21 lines
389 B
Python
_MAP = {
|
|
"y": True,
|
|
"yes": True,
|
|
"t": True,
|
|
"true": True,
|
|
"on": True,
|
|
"1": True,
|
|
"n": False,
|
|
"no": False,
|
|
"f": False,
|
|
"false": False,
|
|
"off": False,
|
|
"0": False,
|
|
}
|
|
|
|
|
|
def strtobool(value):
|
|
try:
|
|
return _MAP[str(value).lower()]
|
|
except KeyError as e:
|
|
raise ValueError('"{}" is not a valid bool value'.format(value)) from e
|