feat: remove strtobool

This commit is contained in:
vrenaville
2024-09-05 14:37:18 +02:00
parent 8046783eff
commit 7d5a0f2d43
6 changed files with 66 additions and 3 deletions
@@ -6,7 +6,7 @@ import logging
import os import os
import time import time
from contextlib import closing, contextmanager from contextlib import closing, contextmanager
from distutils.util import strtobool from .strtobool import strtobool
import psycopg2 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
+1 -1
View File
@@ -5,7 +5,7 @@ import logging
import os import os
import re import re
from collections import namedtuple from collections import namedtuple
from distutils.util import strtobool from .strtobool import strtobool
from odoo import api, models from odoo import api, models
from odoo.tools.config import config from odoo.tools.config import config
+21
View File
@@ -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
+1 -1
View File
@@ -5,7 +5,7 @@ import logging
import os import os
import threading import threading
import uuid import uuid
from distutils.util import strtobool from .strtobool import strtobool
from odoo import http from odoo import http
+21
View File
@@ -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