Skip to content

Commit

Permalink
Update events.py
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl authored Dec 28, 2023
1 parent 7d44a6b commit db6d265
Showing 1 changed file with 4 additions and 50 deletions.
54 changes: 4 additions & 50 deletions ovos_utils/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,17 +204,8 @@ def clear(self):
class EventSchedulerInterface:
"""Interface for accessing the event scheduler over the message bus."""

def __init__(self, name=None, sched_id=None, bus=None, skill_id=None):
# NOTE: can not rename or move sched_id/name arguments to keep api
# compatibility
if name:
log_deprecation("name argument has been deprecated! "
"use skill_id instead", "0.1.0")
if sched_id:
log_deprecation("sched_id argument has been deprecated! "
"use skill_id instead", "0.1.0")

self.skill_id = skill_id or sched_id or name or self.__class__.__name__
def __init__(self, bus=None, skill_id=None):
self.skill_id = skill_id or self.__class__.__name__.lower()
self.bus = bus
self.events = EventContainer(bus)
self.scheduled_repeats = []
Expand All @@ -228,14 +219,13 @@ def set_bus(self, bus):
self.bus = bus
self.events.set_bus(bus)

def set_id(self, sched_id: str):
def set_id(self, skill_id: str):
"""
Attach the skill_id of the parent skill
Args:
sched_id (str): skill_id of the parent skill
skill_id (str): skill_id of the parent skill
"""
# NOTE: can not rename sched_id kwarg to keep api compatibility
self.skill_id = sched_id

def _get_source_message(self):
Expand Down Expand Up @@ -425,39 +415,3 @@ def shutdown(self):
"""
self.cancel_all_repeating_events()
self.events.clear()

@property
@deprecated("self.sched_id has been deprecated! use self.skill_id instead",
"0.1.0")
def sched_id(self):
"""DEPRECATED: do not use, method only for api backwards compatibility
Logs a warning and returns self.skill_id
"""
return self.skill_id

@sched_id.setter
@deprecated("self.sched_id has been deprecated! use self.skill_id instead",
"0.1.0")
def sched_id(self, skill_id):
"""DEPRECATED: do not use, method only for api backwards compatibility
Logs a warning and sets self.skill_id
"""
self.skill_id = skill_id

@property
@deprecated("self.name has been deprecated! use self.skill_id instead",
"0.1.0")
def name(self):
"""DEPRECATED: do not use, method only for api backwards compatibility
Logs a warning and returns self.skill_id
"""
return self.skill_id

@name.setter
@deprecated("self.name has been deprecated! use self.skill_id instead",
"0.1.0")
def name(self, skill_id):
"""DEPRECATED: do not use, method only for api backwards compatibility
Logs a warning and sets self.skill_id
"""
self.skill_id = skill_id

0 comments on commit db6d265

Please sign in to comment.