How to use the transitions.Machine.__init__ function in transitions

To help you get started, we’ve selected a few transitions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pytransitions / transitions / tests / utils.py View on Github external
def __init__(self, states, initial='A'):

        self.state = None

        Machine.__init__(self, states=states, initial=initial)
github Juniper / py-junos-eznc / lib / jnpr / junos / factory / state_machine.py View on Github external
'after': 'parse_using_delimiter'},
            {'trigger': 'regex_with_item', 'source': ['start', 'regex_data'],
             'dest': 'regex_data', 'after': 'parse_using_item_and_regex'},
            {'trigger': 'regex_parser', 'source': 'start',
             'dest': 'regex_data', 'after': 'parse_using_regex'},
            {'trigger': 'regex_parser', 'source': 'regex_data',
             'dest': 'regex_data', 'after': 'parse_using_regex'},
            {'trigger': 'regex_parser', 'source': 'row_column',
             'dest': 'regex_data', 'after': 'parse_using_regex'},
            {'trigger': 'exists_check', 'source': ['start', 'regex_data',
                                                   'row_column'],
             'dest': 'exists_bool_data', 'after': 'parse_exists'},
            {'trigger': 'exists_check', 'source': 'title_data',
             'dest': 'exists_bool_data', 'after': 'parse_exists'},
        ]
        Machine.__init__(self, states=self.states, transitions=self.transitions,
                         initial='start', send_event=True)
github ska-sa / montblanc / montblanc / impl / biro / common / fsm / __init__.py View on Github external
def __init__(self, composite_solver):
        Machine.__init__(self, states=states,
            transitions=transitions, initial=START)
        self.comp_slvr = slvr = composite_solver
        self.sub_time_diff = np.array([s.ntime for s in slvr.solvers])
        self.sub_time_end = np.cumsum(self.sub_time_diff)
        self.sub_time_begin = self.sub_time_end - self.sub_time_diff

        self.X2_gpu_arys = [None for s in slvr.solvers]

        with slvr.context:
            for subslvr in slvr.solvers:
                subslvr.X2_tmp = slvr.pinned_mem_pool.allocate(
                    shape=slvr.X2_shape, dtype=slvr.X2_dtype)