baseimage-tutorial-framework/lib/tfw/linear_fsm.py

13 lines
488 B
Python
Raw Normal View History

# Copyright (C) 2018 Avatao.com Innovative Learning Kft.
# All Rights Reserved. See LICENSE file for details.
2018-04-07 13:21:13 +00:00
from .fsm_base import FSMBase
class LinearFSM(FSMBase):
def __init__(self, number_of_steps):
self.states = list(map(str, range(number_of_steps)))
self.transitions = [{'trigger': 'step_{}'.format(int(index)+1), 'source': index, 'dest': str(int(index)+1)}
2018-04-07 13:21:13 +00:00
for index in self.states[:-1]]
super(LinearFSM, self).__init__()