mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-05 14:51:22 +00:00
Optimize FSMBase by using generators for predicate logic
This commit is contained in:
parent
f78f01d6e1
commit
0e8f529726
@ -52,10 +52,10 @@ class FSMBase(Machine, CallbackMixin):
|
||||
]
|
||||
|
||||
def step(self, trigger):
|
||||
predicate_results = [
|
||||
predicate_results = (
|
||||
predicate()
|
||||
for predicate in self.trigger_predicates[trigger]
|
||||
]
|
||||
)
|
||||
|
||||
# TODO: think about what could we do when this prevents triggering
|
||||
if all(predicate_results):
|
||||
|
Loading…
Reference in New Issue
Block a user