use warnings package to report deprecated code

This commit is contained in:
Aleix Conchillo Flaqué
2024-10-22 10:02:21 -07:00
parent 61d73f81ae
commit 8d75fcc9f0
3 changed files with 15 additions and 5 deletions

View File

@@ -108,7 +108,9 @@ class DailyTranscriptionSettings(BaseModel):
with warnings.catch_warnings():
warnings.simplefilter("always")
if "tier" in values:
warnings.warn("'tier' is deprecated, use 'model' instead", DeprecationWarning)
warnings.warn(
"Field 'tier' is deprecated, use 'model' instead.", DeprecationWarning
)
return values

View File

@@ -4,9 +4,13 @@
# SPDX-License-Identifier: BSD 2-Clause License
#
from loguru import logger
import warnings
logger.warning("DEPRECATED: Package `pipecat.vad` is deprecated, use `pipecat.audio.vad` instead.")
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn(
"Package `pipecat.vad` is deprecated, use `pipecat.audio.vad` instead", DeprecationWarning
)
from ..audio.vad.silero import SileroVADAnalyzer
from ..processors.audio.vad.silero import SileroVAD

View File

@@ -4,8 +4,12 @@
# SPDX-License-Identifier: BSD 2-Clause License
#
from loguru import logger
import warnings
logger.warning("DEPRECATED: Package `pipecat.vad` is deprecated, use `pipecat.audio.vad` instead.")
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn(
"Package `pipecat.vad` is deprecated, use `pipecat.audio.vad` instead", DeprecationWarning
)
from ..audio.vad.vad_analyzer import VADAnalyzer, VADParams, VADState