From 91c257554f65476d7293ded82980498c103a8066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Tue, 3 Jul 2018 20:09:47 +0200 Subject: [PATCH] Simplify callback monkeypatching logic in YamlFSM --- lib/tfw/yaml_fsm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tfw/yaml_fsm.py b/lib/tfw/yaml_fsm.py index bb16b12..b4fd45a 100644 --- a/lib/tfw/yaml_fsm.py +++ b/lib/tfw/yaml_fsm.py @@ -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):