From 93bb4ca1b62f2268c4e28fd98c939a8696131790 Mon Sep 17 00:00:00 2001 From: David Greaves Date: Fri, 5 Jan 2024 19:17:18 +0000 Subject: [PATCH 1/3] Just publish the skill_id without the extra ":" Signed-off-by: David Greaves --- ovos_workshop/skills/ovos.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ovos_workshop/skills/ovos.py b/ovos_workshop/skills/ovos.py index 57648066..037e429f 100644 --- a/ovos_workshop/skills/ovos.py +++ b/ovos_workshop/skills/ovos.py @@ -1185,8 +1185,7 @@ def default_shutdown(self): f'error: {e}') self.bus.emit( - Message('detach_skill', {'skill_id': f"{self.skill_id}:"}, - {"skill_id": self.skill_id})) + Message('detach_skill', {'skill_id': self.skill_id})) def detach(self): """ From c3c13262de8a31414021add07c1d7339f22f7440 Mon Sep 17 00:00:00 2001 From: JarbasAI <33701864+JarbasAl@users.noreply.github.com> Date: Sat, 6 Jan 2024 02:02:03 +0000 Subject: [PATCH 2/3] Update ovos.py --- ovos_workshop/skills/ovos.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/ovos_workshop/skills/ovos.py b/ovos_workshop/skills/ovos.py index 037e429f..9e6ab583 100644 --- a/ovos_workshop/skills/ovos.py +++ b/ovos_workshop/skills/ovos.py @@ -169,7 +169,7 @@ def __init__(self, name: Optional[str] = None, # include any logic needed to handle the updated settings. self.settings_change_callback = None - # fully initialized when self.skill_id is set + # fully initialized when self. is set self._file_system = None self.reload_skill = True # allow reloading (default True) @@ -198,8 +198,8 @@ def __init__(self, name: Optional[str] = None, self._threads = [] # for killable events decorator # yay, following python best practices again! - if self.skill_id and bus: - self._startup(bus, self.skill_id) + if self. and bus: + self._startup(bus, self.) # skill developer abstract methods # devs are meant to override these @@ -223,7 +223,7 @@ def handle_activate(self, message: Message): Called when this skill is considered active by the intent service; converse method will be called with every utterance. Override this method to do any optional preparation. - @param message: `{self.skill_id}.activate` Message + @param message: `{self.}.activate` Message """ def handle_deactivate(self, message: Message): @@ -231,7 +231,7 @@ def handle_deactivate(self, message: Message): Called when this skill is no longer considered active by the intent service; converse method will not be called until skill is active again. Override this method to do any optional cleanup. - @param message: `{self.skill_id}.deactivate` Message + @param message: `{self.}.deactivate` Message """ def converse(self, message: Optional[Message] = None) -> bool: @@ -325,15 +325,15 @@ def converse_is_implemented(self) -> bool: return self.__class__.converse is not OVOSSkill.converse or \ self._original_converse != self.converse - # safe skill_id/bus wrapper properties + # safe /bus wrapper properties @property - def alphanumeric_skill_id(self) -> str: + def alphanumeric_(self) -> str: """ Skill id converted to only alphanumeric characters and "_". Non alphanumeric characters are converted to "_" """ return ''.join(c if c.isalnum() else '_' - for c in str(self.skill_id)) + for c in str(self.)) @property def lang_detector(self): @@ -364,7 +364,7 @@ def settings_path(self) -> str: """ Absolute file path of this skill's `settings.json` (file may not exist) """ - return join(get_xdg_config_save_path(), 'skills', self.skill_id, + return join(get_xdg_config_save_path(), 'skills', self., 'settings.json') @property @@ -378,7 +378,7 @@ def settings(self) -> JsonStorage: self.log.warning('Skill not fully initialized. Only default values ' 'can be set, no settings can be read or changed.' f"to correct this add kwargs " - f"__init__(bus=None, skill_id='') " + f"__init__(bus=None, ='') " f"to skill class {self.__class__.__name__}") self.log.error(simple_trace(traceback.format_stack())) return self._initial_settings @@ -1185,7 +1185,8 @@ def default_shutdown(self): f'error: {e}') self.bus.emit( - Message('detach_skill', {'skill_id': self.skill_id})) + Message('detach_skill', {'skill_id': self.skill_id}, + {'skill_id': self.skill_id})) def detach(self): """ From 76fe332a2c50074c8d822e5f6ad0f36a319cd159 Mon Sep 17 00:00:00 2001 From: JarbasAI <33701864+JarbasAl@users.noreply.github.com> Date: Sat, 6 Jan 2024 02:07:27 +0000 Subject: [PATCH 3/3] Update ovos.py --- ovos_workshop/skills/ovos.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ovos_workshop/skills/ovos.py b/ovos_workshop/skills/ovos.py index 9e6ab583..c9abd72d 100644 --- a/ovos_workshop/skills/ovos.py +++ b/ovos_workshop/skills/ovos.py @@ -169,7 +169,7 @@ def __init__(self, name: Optional[str] = None, # include any logic needed to handle the updated settings. self.settings_change_callback = None - # fully initialized when self. is set + # fully initialized when self.skill_id is set self._file_system = None self.reload_skill = True # allow reloading (default True) @@ -198,8 +198,8 @@ def __init__(self, name: Optional[str] = None, self._threads = [] # for killable events decorator # yay, following python best practices again! - if self. and bus: - self._startup(bus, self.) + if self.skill_id and bus: + self._startup(bus, self.skill_id) # skill developer abstract methods # devs are meant to override these @@ -223,7 +223,7 @@ def handle_activate(self, message: Message): Called when this skill is considered active by the intent service; converse method will be called with every utterance. Override this method to do any optional preparation. - @param message: `{self.}.activate` Message + @param message: `{self.skill_id}.activate` Message """ def handle_deactivate(self, message: Message): @@ -231,7 +231,7 @@ def handle_deactivate(self, message: Message): Called when this skill is no longer considered active by the intent service; converse method will not be called until skill is active again. Override this method to do any optional cleanup. - @param message: `{self.}.deactivate` Message + @param message: `{self.skill_id}.deactivate` Message """ def converse(self, message: Optional[Message] = None) -> bool: @@ -325,15 +325,15 @@ def converse_is_implemented(self) -> bool: return self.__class__.converse is not OVOSSkill.converse or \ self._original_converse != self.converse - # safe /bus wrapper properties + # safe skill_id/bus wrapper properties @property - def alphanumeric_(self) -> str: + def alphanumeric_skill_id(self) -> str: """ Skill id converted to only alphanumeric characters and "_". Non alphanumeric characters are converted to "_" """ return ''.join(c if c.isalnum() else '_' - for c in str(self.)) + for c in str(self.skill_id)) @property def lang_detector(self): @@ -364,7 +364,7 @@ def settings_path(self) -> str: """ Absolute file path of this skill's `settings.json` (file may not exist) """ - return join(get_xdg_config_save_path(), 'skills', self., + return join(get_xdg_config_save_path(), 'skills', self.skill_id, 'settings.json') @property @@ -378,7 +378,7 @@ def settings(self) -> JsonStorage: self.log.warning('Skill not fully initialized. Only default values ' 'can be set, no settings can be read or changed.' f"to correct this add kwargs " - f"__init__(bus=None, ='') " + f"__init__(bus=None, skill_id='') " f"to skill class {self.__class__.__name__}") self.log.error(simple_trace(traceback.format_stack())) return self._initial_settings @@ -1185,7 +1185,7 @@ def default_shutdown(self): f'error: {e}') self.bus.emit( - Message('detach_skill', {'skill_id': self.skill_id}, + Message('detach_skill', {'skill_id': self.skill_id}, {'skill_id': self.skill_id})) def detach(self):