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

remove strtobool, removed in python-3.12 #32

Merged
Merged
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
22 changes: 21 additions & 1 deletion component_registry_bindings/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,32 @@
component-registry-bindings helpers
"""
import json
from distutils.util import strtobool
from os import getenv
from typing import Any, Union

from .exceptions import ComponentRegistryBindingsException

_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,
Expand Down
Loading