mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 18:51:31 +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):
|
def step(self, trigger):
|
||||||
predicate_results = [
|
predicate_results = (
|
||||||
predicate()
|
predicate()
|
||||||
for predicate in self.trigger_predicates[trigger]
|
for predicate in self.trigger_predicates[trigger]
|
||||||
]
|
)
|
||||||
|
|
||||||
# TODO: think about what could we do when this prevents triggering
|
# TODO: think about what could we do when this prevents triggering
|
||||||
if all(predicate_results):
|
if all(predicate_results):
|
||||||
|
Loading…
Reference in New Issue
Block a user