diff --git a/osidb_bindings/helpers.py b/osidb_bindings/helpers.py index aef5b09..23b4a1e 100644 --- a/osidb_bindings/helpers.py +++ b/osidb_bindings/helpers.py @@ -2,12 +2,33 @@ osidb-registry-bindings helpers """ import json -from distutils.util import strtobool from os import getenv from typing import Any, Union from .exceptions import OSIDBBindingsException +_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)) + def get_env( key: str,