Skip to content

Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.

fix(utils): remove distutils boolean parser

Ting Zhang2230a8221718
diff --git a/funasr/utils/type_utils.py b/funasr/utils/type_utils.py
index 0731e46f8..d1d4bae05 100644
--- a/funasr/utils/type_utils.py
+++ b/funasr/utils/type_utils.py
@@ -1,4 +1,3 @@
-from distutils.util import strtobool
from typing import Optional
from typing import Tuple
from typing import Union
@@ -15,7 +14,12 @@ def str2bool(value: str) -> bool:
Args:
value: TODO.
"""
- return bool(strtobool(value))
+ normalized = value.lower()
+ if normalized in ("y", "yes", "t", "true", "on", "1"):
+ return True
+ if normalized in ("n", "no", "f", "false", "off", "0"):
+ return False
+ raise ValueError(f"invalid truth value {value!r}")
def remove_parenthesis(value: str):