Skip to content

Commit

Permalink
OVOSkill no longer a direct subclass of MycroftSkill
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Sep 12, 2023
1 parent 7c93c02 commit 6917a3d
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions ovos_workshop/skills/ovos.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import re
from abc import ABCMeta
from threading import Event

from typing import List, Optional, Union

from ovos_bus_client import MessageBusClient
Expand All @@ -11,13 +11,29 @@
from ovos_utils.skills.audioservice import OCPInterface
from ovos_utils.skills.settings import PrivateSettings
from ovos_utils.sound import play_audio
from ovos_workshop.decorators.layers import IntentLayers
from ovos_workshop.resource_files import SkillResources
from ovos_workshop.skills.base import BaseSkill
from ovos_workshop.skills.mycroft_skill import is_classic_core, MycroftSkill

from ovos_workshop.decorators.layers import IntentLayers
from ovos_workshop.skills.mycroft_skill import MycroftSkill, is_classic_core

class _OVOSSkillMetaclass(ABCMeta):
"""
To override isinstance checks
"""

def __instancecheck__(self, instance):
if is_classic_core():
# instance imported from vanilla mycroft
from mycroft.skills import MycroftSkill as _CoreSkill
if issubclass(self.__class__, _CoreSkill):
return True

return super().__instancecheck__(instance) or \
issubclass(self.__class__, MycroftSkill)


class OVOSSkill(MycroftSkill):
class OVOSSkill(BaseSkill, metaclass=_OVOSSkillMetaclass):
"""
New features:
- all patches for MycroftSkill class
Expand Down Expand Up @@ -140,7 +156,7 @@ def play_audio(self, filename: str):
core_supported = True # min version of ovos-core
except ImportError:
# skills don't require core anymore, running standalone
core_supported = True
core_supported = True

if core_supported:
message = dig_for_message() or Message("")
Expand Down Expand Up @@ -223,7 +239,7 @@ def _register_decorated(self):

def register_intent_layer(self, layer_name: str,
intent_list: List[Union[IntentBuilder, Intent,
str]]):
str]]):
"""
Register a named intent layer.
@param layer_name: Name of intent layer to add
Expand Down

0 comments on commit 6917a3d

Please sign in to comment.