Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove strtobool #469

Open
wants to merge 1 commit into
base: 15.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion base_attachment_object_storage/models/ir_attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os
import time
from contextlib import closing, contextmanager
from distutils.util import strtobool
from .strtobool import strtobool

import psycopg2

Expand Down
21 changes: 21 additions & 0 deletions base_attachment_object_storage/models/strtobool.py
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion cloud_platform/models/cloud_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import os
import re
from collections import namedtuple
from distutils.util import strtobool
from .strtobool import strtobool

from odoo import api, models
from odoo.tools.config import config
Expand Down
21 changes: 21 additions & 0 deletions cloud_platform/models/strtobool.py
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion logging_json/json_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import os
import threading
import uuid
from distutils.util import strtobool
from .strtobool import strtobool

from odoo import http

Expand Down
21 changes: 21 additions & 0 deletions logging_json/strtobool.py
Original file line number Diff line number Diff line change
@@ -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
Loading