Skip to content

Commit

Permalink
fix:Typing
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Oct 16, 2024
1 parent eb0fca8 commit 8744cdc
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
8 changes: 6 additions & 2 deletions ovos_core/intent_services/converse_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
from ovos_utils import flatten_list
from ovos_utils.fakebus import FakeBus
from ovos_utils.lang import standardize_lang_tag
from ovos_utils.log import LOG
from ovos_utils.log import LOG, deprecated


class ConverseService(PipelineStageMatcher):
"""Intent Service handling conversational skills."""

def __init__(self, bus: Optional[Union[MessageBusClient, FakeBus]] = None,
config: Optional[Dict] = None):
config = config or Configuration().get("skills", {}).get("converse")
config = config or Configuration().get("skills", {}).get("converse", {})
super().__init__(bus, config)
self._consecutive_activations = {}
self.bus.on('mycroft.speech.recognition.unknown', self.reset_converse)
Expand Down Expand Up @@ -407,6 +407,10 @@ def handle_get_active_skills(self, message: Message):
self.bus.emit(message.reply("intent.service.active_skills.reply",
{"skills": self.get_active_skills(message)}))

@deprecated("'converse_with_skills' has been renamed to 'match'", "2.0.0")
def converse_with_skills(self, utterances: List[str], lang: str, message: Message = None) -> Optional[PipelineMatch]:
return self.match(utterances, lang, message)

def shutdown(self):
self.bus.remove('mycroft.speech.recognition.unknown', self.reset_converse)
self.bus.remove('intent.service.skills.deactivate', self.handle_deactivate_skill_request)
Expand Down
24 changes: 23 additions & 1 deletion ovos_core/intent_services/fallback_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from ovos_utils import flatten_list
from ovos_utils.fakebus import FakeBus
from ovos_utils.lang import standardize_lang_tag
from ovos_utils.log import LOG
from ovos_utils.log import LOG, deprecated, log_deprecation

FallbackRange = namedtuple('FallbackRange', ['start', 'stop'])

Expand Down Expand Up @@ -216,6 +216,28 @@ def match_low(self, utterances: List[str], lang: str, message: Message) -> Optio
return self._fallback_range(utterances, lang, message,
FallbackRange(90, 101))

@deprecated("'low_prio' has been renamed to 'match_low'", "2.0.0")
def low_prio(self, utterances: List[str], lang: str, message: Message = None) -> Optional[PipelineMatch]:
return self.match_low(utterances, lang, message)

@deprecated("'medium_prio' has been renamed to 'match_medium'", "2.0.0")
def medium_prio(self, utterances: List[str], lang: str, message: Message = None) -> Optional[PipelineMatch]:
return self.match_medium(utterances, lang, message)

@deprecated("'high_prio' has been renamed to 'high_low'", "2.0.0")
def high_prio(self, utterances: List[str], lang: str, message: Message = None) -> Optional[PipelineMatch]:
return self.match_high(utterances, lang, message)

@property
def fallback_config(self) -> Dict:
log_deprecation("'self.fallback_config' is deprecated, access 'self.config' directly instead", "1.0.0")
return self.config

@fallback_config.setter
def fallback_config(self, val):
log_deprecation("'self.fallback_config' is deprecated, access 'self.config' directly instead", "1.0.0")
self.config = val

def shutdown(self):
self.bus.remove("ovos.skills.fallback.register", self.handle_register_fallback)
self.bus.remove("ovos.skills.fallback.deregister", self.handle_deregister_fallback)

0 comments on commit 8744cdc

Please sign in to comment.