Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 46 additions & 1 deletion neon_utils/skills/common_query_skill.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,56 @@
from ovos_workshop.decorators.layers import IntentLayers
from ovos_workshop.skills.common_query_skill import CQSMatchLevel, CQSVisualMatchLevel
from ovos_workshop.skills.common_query_skill import CommonQuerySkill as _CQS
from ovos_workshop.decorators.compat import backwards_compat
from ovos_utils.file_utils import resolve_resource_file
from ovos_utils.log import log_deprecation, LOG
from neon_utils.skills.neon_skill import NeonSkill

try:
from ovos_workshop.decorators.compat import backwards_compat
except ImportError:
from functools import wraps
def backwards_compat(classic_core=None, pre_008=None, no_core=None):
"""
Decorator to run a different method if specific ovos-core versions are detected
"""

def backwards_compat_decorator(func):
is_classic = False
is_old = False
is_standalone = True
try:
from mycroft.version import CORE_VERSION_STR # all classic mycroft and ovos versions
is_classic = True
is_standalone = False

try:
from ovos_core.version import OVOS_VERSION_MINOR # ovos-core >= 0.0.8
is_classic = False
except ImportError:
is_old = True
try:
from mycroft.version import OVOS_VERSION_MINOR # ovos-core <= 0.0.7
is_classic = False
except:
is_standalone = True

except:
is_standalone = True

@wraps(func)
def func_wrapper(*args, **kwargs):
if is_classic and callable(classic_core):
return classic_core(*args, **kwargs)
if is_old and callable(pre_008):
return pre_008(*args, **kwargs)
if is_standalone and callable(no_core):
return no_core(*args, **kwargs)
return func(*args, **kwargs)

return func_wrapper

return backwards_compat_decorator


def is_CQSVisualMatchLevel(match_level):
log_deprecation("This method is deprecated", "2.0.0")
Expand Down
5 changes: 4 additions & 1 deletion neon_utils/skills/mycroft_skill.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@
from json_database import JsonStorage
from ovos_bus_client.message import Message
from ovos_utils.log import log_deprecation, deprecated
from ovos_workshop.skills.mycroft_skill import MycroftSkill
try:
from ovos_workshop.skills.mycroft_skill import MycroftSkill
except ImportError:
from ovos_workshop.skills.ovos import OVOSSkill as MycroftSkill
# from ovos_utils.skills.settings import get_local_settings

from neon_utils.signal_utils import wait_for_signal_clear, check_for_signal
Expand Down
14 changes: 7 additions & 7 deletions neon_utils/skills/neon_fallback_skill.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@
from ovos_utils.log import LOG, log_deprecation, deprecated
from ovos_utils.skills import get_non_properties
from ovos_utils.xdg_utils import xdg_cache_home
from ovos_workshop.skills import OVOSSkill
from ovos_workshop.skills.fallback import FallbackSkillV1
from ovos_workshop.skills.ovos import OVOSSkill
from ovos_workshop.skills.fallback import FallbackSkill

from neon_utils.cache_utils import LRUCache
from neon_utils.file_utils import resolve_neon_resource_file
from neon_utils.location_utils import to_system_time
from neon_utils.message_utils import dig_for_message, resolve_message, get_message_user
from neon_utils.skills.neon_skill import CACHE_TIME_OFFSET, DEFAULT_SPEED_MODE, SPEED_MODE_EXTENSION_TIME, NeonSkill, \
from neon_utils.skills.neon_skill import CACHE_TIME_OFFSET, DEFAULT_SPEED_MODE, SPEED_MODE_EXTENSION_TIME, \
save_settings
from neon_utils.user_utils import get_user_prefs

Expand All @@ -62,7 +62,7 @@
OVOSLangTranslationFactory = None


class NeonFallbackSkill(FallbackSkillV1):
class NeonFallbackSkill(FallbackSkill):
"""
Class that extends the NeonSkill and FallbackSkill classes to provide
NeonSkill functionality to any Fallback skill subclassing this class.
Expand All @@ -72,9 +72,9 @@ def __init__(self, *args, **kwargs):
"`ovos_workshop.skills.fallback.FallbackSkill`",
"2.0.0")

FallbackSkillV1.__init__(self, *args, **kwargs)
LOG.debug(f"instance_handlers={self.instance_fallback_handlers}")
LOG.debug(f"class_handlers={FallbackSkillV1.fallback_handlers}")
FallbackSkill.__init__(self, *args, **kwargs)
# LOG.debug(f"instance_handlers={self.instance_fallback_handlers}")
# LOG.debug(f"class_handlers={FallbackSkill.fallback_handlers}")

# Manual init of NeonSkill
self.cache_loc = os.path.join(xdg_cache_home(), "neon")
Expand Down
2 changes: 1 addition & 1 deletion neon_utils/skills/skill_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from os.path import join
from ovos_utils.log import LOG, log_deprecation
from neon_utils.file_utils import resolve_neon_resource_file
from ovos_workshop.skills.base import SkillGUI as _SkillGUI
from ovos_workshop.skills.ovos import SkillGUI as _SkillGUI


class SkillGUI(_SkillGUI):
Expand Down
6 changes: 5 additions & 1 deletion neon_utils/validator_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@

from lingua_franca import parse, set_default_lang

from ovos_workshop.skills.mycroft_skill import MycroftSkill
try:
# TODO: Remove this import and use OVOSSkill with neon-utils 2.0.0
from ovos_workshop.skills.mycroft_skill import MycroftSkill
except ImportError:
from ovos_workshop.skills.ovos import OVOSSkill as MycroftSkill


def numeric_confirmation_validator(confirmation_num: str, lang: str = "en"):
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ ovos-lingua-franca~=0.4
ovos-utils~=0.0,>=0.0.35
geopy~=2.1
ovos-config~=0.0,>=0.0.9
ovos-workshop~=0.0,>=0.0.15
ovos-workshop>=0.0.15,<8.0
Loading