mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-12-23 03:21:57 +00:00
Simplify callback monkeypatching logic in YamlFSM
This commit is contained in:
parent
022a997dc2
commit
91c257554f
@ -31,10 +31,10 @@ class YamlFSM(FSMBase):
|
||||
topatch = {'on_enter', 'on_exit', 'prepare', 'before', 'after'}
|
||||
|
||||
for array in {'states', 'transitions'}:
|
||||
for i, json_obj in enumerate(self.config[array]):
|
||||
for json_obj in self.config[array]:
|
||||
for attribute, value in json_obj.items():
|
||||
if attribute in topatch:
|
||||
self.config[array][i][attribute] = partial(self.run, value)
|
||||
json_obj[attribute] = partial(self.run, value)
|
||||
|
||||
@staticmethod
|
||||
def run(command, event):
|
||||
|
Loading…
Reference in New Issue
Block a user