mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-12-23 07:21:55 +00:00
Refactor FSMManager.(un)?subscribe() family of methods to accept lists
This commit is contained in:
parent
5d7223779a
commit
770123310a
@ -60,11 +60,12 @@ class FSMManager:
|
||||
try: self.fsm.trigger(trigger, message=message)
|
||||
except AttributeError: log.debug('FSM failed to execute nonexistent trigger: "{}"'.format(trigger))
|
||||
|
||||
def subscribe_predicate(self, trigger, predicate):
|
||||
self.trigger_predicates[trigger].append(predicate)
|
||||
def subscribe_predicate(self, trigger, *predicates):
|
||||
self.trigger_predicates[trigger].extend(predicates)
|
||||
|
||||
def unsubscribe_predicate(self, trigger, predicate):
|
||||
self.trigger_predicates[trigger].remove(predicate)
|
||||
def unsubscribe_predicate(self, trigger, *predicates):
|
||||
self.trigger_predicates[trigger] = [predicate for predicate in self.trigger_predicates[trigger]
|
||||
not in predicates]
|
||||
|
||||
|
||||
class FSMUpdater:
|
||||
|
Loading…
Reference in New Issue
Block a user