From ebf2ebe9b89a106a38b2c40fd67f30dae081bf36 Mon Sep 17 00:00:00 2001 From: JarbasAi Date: Thu, 21 Sep 2023 04:24:22 +0100 Subject: [PATCH] restor backwaeds compat method --- ovos_workshop/skills/base.py | 25 +++++++++++++++++++------ ovos_workshop/skills/mycroft_skill.py | 12 ------------ 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/ovos_workshop/skills/base.py b/ovos_workshop/skills/base.py index 3da7b527..dca29406 100644 --- a/ovos_workshop/skills/base.py +++ b/ovos_workshop/skills/base.py @@ -26,16 +26,18 @@ from threading import Event, RLock from typing import List, Optional, Dict, Callable, Union -from ovos_bus_client import MessageBusClient -from ovos_bus_client.session import SessionManager from json_database import JsonStorage from lingua_franca.format import pronounce_number, join_list from lingua_franca.parse import yes_or_no, extract_number from ovos_backend_client.api import EmailApi, MetricsApi -from ovos_bus_client.message import Message, dig_for_message from ovos_config.config import Configuration from ovos_config.locations import get_xdg_config_save_path + +from ovos_bus_client import MessageBusClient +from ovos_bus_client.message import Message, dig_for_message +from ovos_bus_client.session import SessionManager from ovos_utils import camel_case_split +from ovos_utils import classproperty from ovos_utils.dialog import get_dialog, MustacheDialogRenderer from ovos_utils.enclosure.api import EnclosureAPI from ovos_utils.events import EventContainer, EventSchedulerInterface @@ -52,8 +54,6 @@ from ovos_utils.parse import match_one from ovos_utils.process_utils import RuntimeRequirements from ovos_utils.skills import get_non_properties -from ovos_utils import classproperty - from ovos_workshop.decorators.compat import backwards_compat from ovos_workshop.decorators.killable import AbortEvent from ovos_workshop.decorators.killable import killable_event, \ @@ -64,6 +64,18 @@ from ovos_workshop.settings import SkillSettingsManager +def is_classic_core(): + try: + from mycroft.version import OVOS_VERSION_STR + return False + except: + try: + import mycroft + return True + except: + return False + + # backwards compat alias class SkillNetworkRequirements(RuntimeRequirements): def __init__(self, *args, **kwargs): @@ -457,7 +469,7 @@ def _secondary_langs(self) -> List[str]: work in regular mycroft-core it was made private! """ return [lang.lower() for lang in self.config_core.get( - 'secondary_langs', []) if lang != self._core_lang] + 'secondary_langs', []) if lang != self._core_lang] # property not present in mycroft-core @property @@ -1000,6 +1012,7 @@ def __get_response(self): Returns: str: user's response or None on a timeout """ + # TODO: Support `message` signature like default? def converse(utterances, lang=None): converse.response = utterances[0] if utterances else None diff --git a/ovos_workshop/skills/mycroft_skill.py b/ovos_workshop/skills/mycroft_skill.py index ca587290..114ff936 100644 --- a/ovos_workshop/skills/mycroft_skill.py +++ b/ovos_workshop/skills/mycroft_skill.py @@ -23,18 +23,6 @@ from ovos_workshop.skills.base import BaseSkill -def is_classic_core(): - try: - from mycroft.version import OVOS_VERSION_STR - return False - except: - try: - import mycroft - return True - except: - return False - - class _SkillMetaclass(ABCMeta): """ This metaclass ensures we can load skills like regular python objects.