Skip to content

Commit

Permalink
Update ovos.py
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl authored Jan 6, 2024
1 parent c3c1326 commit 76fe332
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions ovos_workshop/skills/ovos.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -223,15 +223,15 @@ 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):
"""
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:
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 76fe332

Please sign in to comment.