kopia lustrzana https://github.com/dgtlmoon/changedetection.io
24 wiersze
434 B
Python
24 wiersze
434 B
Python
# Because strtobool was removed in python 3.12 distutils
|
|
|
|
_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:
|
|
raise ValueError('"{}" is not a valid bool value'.format(value))
|