Skip to content

Commit

Permalink
chore: add warnings (#116)
Browse files Browse the repository at this point in the history
* chore: add warnings

make IDEs signal deprecated code instead of relying on runtime logs only

* update python version
  • Loading branch information
JarbasAl authored Jan 4, 2025
1 parent 09c1de9 commit 12d310f
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/license_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ovos_audio/playback.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 11 additions & 0 deletions ovos_audio/service.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import base64
import json
import os
import warnings
import os.path
from hashlib import md5
from os.path import exists
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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": {},
Expand Down
19 changes: 16 additions & 3 deletions ovos_audio/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)


Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 12d310f

Please sign in to comment.