From 8744cdc61cdb512186e398a717325f6b0add5be9 Mon Sep 17 00:00:00 2001 From: miro Date: Wed, 16 Oct 2024 10:47:18 +0100 Subject: [PATCH] fix:Typing --- ovos_core/intent_services/converse_service.py | 8 +++++-- ovos_core/intent_services/fallback_service.py | 24 ++++++++++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/ovos_core/intent_services/converse_service.py b/ovos_core/intent_services/converse_service.py index 3f921d76011..5ad860aa212 100644 --- a/ovos_core/intent_services/converse_service.py +++ b/ovos_core/intent_services/converse_service.py @@ -14,7 +14,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 class ConverseService(PipelineStageMatcher): @@ -22,7 +22,7 @@ class ConverseService(PipelineStageMatcher): 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) @@ -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) diff --git a/ovos_core/intent_services/fallback_service.py b/ovos_core/intent_services/fallback_service.py index fcb697d751a..59b5954a0a5 100644 --- a/ovos_core/intent_services/fallback_service.py +++ b/ovos_core/intent_services/fallback_service.py @@ -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']) @@ -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)