From 12d310fd1b5b990ed67eacfa50d61b6d4a464ed2 Mon Sep 17 00:00:00 2001 From: JarbasAI <33701864+JarbasAl@users.noreply.github.com> Date: Sat, 4 Jan 2025 17:16:16 +0000 Subject: [PATCH] chore: add warnings (#116) * chore: add warnings make IDEs signal deprecated code instead of relying on runtime logs only * update python version --- .github/workflows/build_tests.yml | 2 +- .github/workflows/license_tests.yml | 2 +- .github/workflows/publish_stable.yml | 2 +- .github/workflows/release_workflow.yml | 2 +- ovos_audio/playback.py | 2 +- ovos_audio/service.py | 11 +++++++++++ ovos_audio/utils.py | 19 ++++++++++++++++--- 7 files changed, 32 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_tests.yml b/.github/workflows/build_tests.yml index 5a84e66..9de77d5 100644 --- a/.github/workflows/build_tests.yml +++ b/.github/workflows/build_tests.yml @@ -13,7 +13,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v1 with: - python-version: 3.8 + python-version: '3.11' - name: Install Build Tools run: | python -m pip install build wheel diff --git a/.github/workflows/license_tests.yml b/.github/workflows/license_tests.yml index 29f4063..aa37e2d 100644 --- a/.github/workflows/license_tests.yml +++ b/.github/workflows/license_tests.yml @@ -16,7 +16,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v1 with: - python-version: 3.8 + python-version: '3.11' - name: Install Build Tools run: | python -m pip install build wheel diff --git a/.github/workflows/publish_stable.yml b/.github/workflows/publish_stable.yml index e88d3e6..2023307 100644 --- a/.github/workflows/publish_stable.yml +++ b/.github/workflows/publish_stable.yml @@ -26,7 +26,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v1 with: - python-version: 3.8 + python-version: '3.11' - name: Install Build Tools run: | python -m pip install build wheel diff --git a/.github/workflows/release_workflow.yml b/.github/workflows/release_workflow.yml index 3a100be..32fd2cf 100644 --- a/.github/workflows/release_workflow.yml +++ b/.github/workflows/release_workflow.yml @@ -46,7 +46,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v1 with: - python-version: 3.8 + python-version: '3.11' - name: Install Build Tools run: | python -m pip install build wheel diff --git a/ovos_audio/playback.py b/ovos_audio/playback.py index ab0e07c..a2beea4 100644 --- a/ovos_audio/playback.py +++ b/ovos_audio/playback.py @@ -10,7 +10,7 @@ from ovos_plugin_manager.g2p import OVOSG2PFactory from ovos_plugin_manager.templates.g2p import OutOfVocabulary, Grapheme2PhonemePlugin from ovos_plugin_manager.templates.tts import TTS -from ovos_utils.log import LOG, log_deprecation +from ovos_utils.log import LOG from ovos_utils.sound import play_audio from time import time diff --git a/ovos_audio/service.py b/ovos_audio/service.py index c94878b..f9ee6e0 100644 --- a/ovos_audio/service.py +++ b/ovos_audio/service.py @@ -1,6 +1,7 @@ import base64 import json import os +import warnings import os.path from hashlib import md5 from os.path import exists @@ -183,6 +184,11 @@ def get_audio_options(blacklist=None): "active": True, "plugin_name": 'Ovos Common Play'}] """ + warnings.warn( + "'get_audio_options' is deprecated and will be removed in a future release.", + DeprecationWarning, + stacklevel=2, + ) opts = [] return opts @@ -245,6 +251,11 @@ def handle_opm_audio_query(self, message): "configs" - {backend_name: backend_cfg}} "options" - {lang: [list_of_valid_ui_metadata]} """ + warnings.warn( + "'handle_opm_audio_query' is deprecated and will be removed in a future release.", + DeprecationWarning, + stacklevel=2, + ) data = { "plugins": [], "configs": {}, diff --git a/ovos_audio/utils.py b/ovos_audio/utils.py index 8328a26..8c741f9 100644 --- a/ovos_audio/utils.py +++ b/ovos_audio/utils.py @@ -14,7 +14,7 @@ # import time from functools import wraps - +import warnings from ovos_bus_client.send_func import send from ovos_config import Configuration from ovos_utils.log import deprecated, LOG @@ -60,6 +60,11 @@ def is_speaking(): Returns: bool: True while still speaking """ + warnings.warn( + "file signals have been deprecated", + DeprecationWarning, + stacklevel=2, + ) return check_for_signal("isSpeaking", -1) @@ -72,6 +77,11 @@ def wait_while_speaking(): briefly to ensure that any preceeding request to speak has time to begin. """ + warnings.warn( + "file signals have been deprecated", + DeprecationWarning, + stacklevel=2, + ) time.sleep(0.3) # Wait briefly in for any queued speech to begin while is_speaking(): time.sleep(0.1) @@ -84,10 +94,13 @@ def stop_speaking(): TODO: Skills should only be able to stop speech they've initiated """ + warnings.warn( + "file signals have been deprecated", + DeprecationWarning, + stacklevel=2, + ) if is_speaking(): - send('mycroft.audio.speech.stop') - # Block until stopped while check_for_signal("isSpeaking", -1): time.sleep(0.25)