Skip to content

Commit 6382d0a

Browse files
authored
chore: remove deprecated class flagged for removal in 4.0.0 (#400)
* chore: remove deprecated class * chore: remove deprecated class
1 parent 446e661 commit 6382d0a

7 files changed

Lines changed: 1 addition & 482 deletions

File tree

ovos_workshop/skill_launcher.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@
1919
from ovos_workshop.skills.active import ActiveSkill
2020
from ovos_workshop.skills.auto_translatable import UniversalSkill, UniversalFallback
2121
from ovos_workshop.skills.common_play import OVOSCommonPlaybackSkill
22-
from ovos_workshop.skills.common_query_skill import CommonQuerySkill
2322
from ovos_workshop.skills.fallback import FallbackSkill
2423
from ovos_workshop.skills.ovos import OVOSSkill
2524
from ovos_workshop.skills.game_skill import OVOSGameSkill, ConversationalGameSkill
2625

2726
SKILL_BASE_CLASSES = [
28-
OVOSSkill, OVOSCommonPlaybackSkill, CommonQuerySkill, ActiveSkill,
27+
OVOSSkill, OVOSCommonPlaybackSkill, ActiveSkill,
2928
FallbackSkill, UniversalSkill, UniversalFallback, OVOSGameSkill, ConversationalGameSkill
3029
]
3130

ovos_workshop/skills/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22
from ovos_workshop.skills.ovos import OVOSSkill
33
from ovos_workshop.skills.idle_display_skill import IdleDisplaySkill
44
from ovos_workshop.skills.fallback import FallbackSkill
5-
from ovos_workshop.skills.common_query_skill import CommonQuerySkill
65
from ovos_workshop.skills.common_play import OVOSCommonPlaybackSkill

ovos_workshop/skills/auto_translatable.py

Lines changed: 0 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
from abc import ABC
2-
31
from ovos_config import Configuration
42

53
from ovos_bus_client import Message
64
from ovos_utils.events import get_handler_name
75
from ovos_utils.log import LOG
86
from ovos_workshop.resource_files import SkillResources
9-
from ovos_workshop.skills.common_query_skill import CommonQuerySkill
107
from ovos_workshop.skills.fallback import FallbackSkill
118
from ovos_workshop.skills.ovos import OVOSSkill
129

@@ -371,93 +368,3 @@ def register_fallback(self, handler, priority: int):
371368
"""
372369
handler = self.create_universal_fallback_handler(handler)
373370
FallbackSkill.register_fallback(self, handler, priority)
374-
375-
376-
class UniversalCommonQuerySkill(UniversalSkill, CommonQuerySkill, ABC):
377-
"""
378-
CommonQuerySkill that auto translates input/output from any language.
379-
380-
`CQS_match_query_phrase` and `CQS_action` are ensured to receive phrases in
381-
`self.internal_language`.
382-
383-
`CQS_match_query_phrase` is assumed to return a response in `self.internal_language`,
384-
and it will be translated back before speaking.
385-
386-
`self.speak` will always translate utterances from
387-
`self.internal_lang` to `self.lang`.
388-
389-
NOTE: `self.lang` reflects the original query language,
390-
but received utterances are always in `self.internal_language`.
391-
"""
392-
393-
def __handle_query_action(self, message: Message):
394-
"""
395-
Handle the common query action, translating the message if needed.
396-
397-
Parameters:
398-
- message (Message): The message containing the query action.
399-
400-
This method translates the query phrase to the internal language if the
401-
output language (`self.lang` / Session.lang) is different or autodetection is enabled.
402-
Then it invokes the parent method `__handle_query_action`.
403-
404-
This method is internal and should not be called directly.
405-
"""
406-
if message.data["skill_id"] != self.skill_id:
407-
# Not for this skill!
408-
return
409-
if self.lang != self.internal_language or self.autodetect:
410-
message.data["phrase"] = self.translate_utterance(message.data["phrase"],
411-
sauce_lang=self.lang,
412-
target_lang=self.internal_language)
413-
414-
super().__handle_query_action(message)
415-
416-
def __get_cq(self, search_phrase: str):
417-
"""
418-
Get a common query result for the given search phrase.
419-
420-
Parameters:
421-
- search_phrase (str): The search phrase.
422-
423-
Returns:
424-
- tuple or None: A tuple representing the common query result, or None if not found.
425-
426-
This method converts the input into the internal language if needed, gets
427-
the common query result, and converts the response back into the source language.
428-
429-
This method is internal and should not be called directly.
430-
"""
431-
if self.lang == self.internal_language and not self.autodetect:
432-
return super().__get_cq(search_phrase)
433-
434-
# convert input into internal lang
435-
search_phrase = self.translate_utterance(search_phrase, self.internal_language, self.lang)
436-
result = super().__get_cq(search_phrase)
437-
if not result:
438-
return None
439-
answer = result[2]
440-
# convert response back into source lang
441-
answer = self.translate_utterance(answer, self.lang, self.internal_language)
442-
if len(result) > 3:
443-
# optional callback_data
444-
result = (result[0], result[1], answer, result[3])
445-
else:
446-
result = (result[0], result[1], answer)
447-
return result
448-
449-
def remove_noise(self, phrase: str, lang: str = None):
450-
"""
451-
Remove noise to produce the essence of the question.
452-
453-
Parameters:
454-
- phrase (str): The input phrase.
455-
- lang (str, optional): ignored, just for api compat
456-
457-
Returns:
458-
- str: The cleaned phrase.
459-
460-
This method removes noise from the input phrase to extract the essence of the question.
461-
The method uses the `self.internal_language` as the default language.
462-
"""
463-
return super().remove_noise(phrase, self.internal_language)

ovos_workshop/skills/common_query_skill.py

Lines changed: 0 additions & 259 deletions
This file was deleted.

0 commit comments

Comments
 (0)