Skip to content

Commit a270238

Browse files
committed
Remove deprecated module usage, and remove unnecessary dependency
1 parent fa60885 commit a270238

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

kirovy/utils/settings_utils.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
import os
77
from collections.abc import Callable
8+
from functools import lru_cache
89

9-
from distutils.util import strtobool
1010
from typing import Any, Type
1111

1212
from kirovy import exceptions
@@ -107,3 +107,17 @@ def run_environment_valid(key: str, value: str) -> None:
107107
key,
108108
f"Not a valid run environment: options={[x.value for x in settings_constants.RunEnvironment]}, {value=}",
109109
)
110+
111+
112+
@lru_cache()
113+
def strtobool(value: str) -> bool:
114+
truthy = {"y", "yes", "t", "true", "on", "1"}
115+
falsey = {"n", "no", "f", "false", "off", "0"}
116+
value = value.strip().lower()
117+
118+
if value in truthy:
119+
return True
120+
if value in falsey:
121+
return False
122+
123+
raise ValueError(f'"{value}" does not represent a bool')

requirements-dev.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ black==24.*
55
pre-commit==3.*
66
pytest-django==4.*
77
markdown>=3.4.4, <=4.0
8-
setuptools
98
drf-spectacular[sidecar]

0 commit comments

Comments
 (0)