Simplify callback monkeypatching logic in YamlFSM

This commit is contained in:
Kristóf Tóth 2018-07-03 20:09:47 +02:00
parent 022a997dc2
commit 91c257554f

View File

@ -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):