Replace deprecated distutils usage (removed in Python 3.12) (#2550)

Co-authored-by: k9ert <117085+k9ert@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Abhishek Kumar 2026-04-02 18:36:58 +05:30 committed by GitHub
parent fdea9325f9
commit b6c230d1cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,7 +4,6 @@ from datetime import datetime
import json
from flask_babel.speaklater import LazyString
from typing import Union
from distutils.util import strtobool
logger = logging.getLogger(__name__)
@ -15,7 +14,12 @@ def str2bool(my_str):
return False
elif isinstance(my_str, bool):
return my_str
return bool(strtobool(my_str))
if my_str.lower() in ("y", "yes", "t", "true", "on", "1"):
return True
elif my_str.lower() in ("n", "no", "f", "false", "off", "0"):
return False
else:
raise ValueError(f"Invalid truth value {my_str!r}")
def camelcase2snake_case(name):