Skip to content

Commit

Permalink
use warnings package to report deprecated code
Browse files Browse the repository at this point in the history
  • Loading branch information
aconchillo committed Oct 22, 2024
1 parent 61d73f8 commit 8d75fcc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/pipecat/transports/services/daily.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ def check_deprecated_fields(cls, values):
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


Expand Down
8 changes: 6 additions & 2 deletions src/pipecat/vad/silero.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 6 additions & 2 deletions src/pipecat/vad/vad_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 8d75fcc

Please sign in to comment.