mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 20:01:33 +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'}
|
topatch = {'on_enter', 'on_exit', 'prepare', 'before', 'after'}
|
||||||
|
|
||||||
for array in {'states', 'transitions'}:
|
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():
|
for attribute, value in json_obj.items():
|
||||||
if attribute in topatch:
|
if attribute in topatch:
|
||||||
self.config[array][i][attribute] = partial(self.run, value)
|
json_obj[attribute] = partial(self.run, value)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run(command, event):
|
def run(command, event):
|
||||||
|
Loading…
Reference in New Issue
Block a user