mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-24 08:47:40 +00:00
feat: remove strtobool
This commit is contained in:
@@ -6,7 +6,7 @@ import logging
|
||||
import os
|
||||
import time
|
||||
from contextlib import closing, contextmanager
|
||||
from distutils.util import strtobool
|
||||
from .strtobool import strtobool
|
||||
|
||||
import psycopg2
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
_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 error:
|
||||
raise ValueError('"{}" is not a valid bool value'.format(value)) from error
|
||||
Reference in New Issue
Block a user