A fine state machine
Project description
Installation
pip install finesm
Usage
from finesm import Stat, StateMachine
class MyStateMachine(StateMachine):
stop = State(default=True)
go = State()
@stop.on_message('switch')
def stop_switch(self):
self.set_state(go)
@stop.on_exit
def stop_exit(self):
print('exiting stop state')
@go.on_enter
def go_enter(self):
print('entering go state')
@go.on_update
def go_update(self):
print('tick')
sm = MyStateMachine()
sm.state # stop
sm.update() #
sm.send_message('switch') # exiting stop state
# entering go state
sm.update() # tick
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
finesm-0.0.0.tar.gz
(2.1 kB
view hashes)
Built Distribution
Close
Hashes for finesm-0.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a70c25d706b83e99ae312f01eac1a6ac36c97a24e00d90af6676c8f21d6bcc80 |
|
MD5 | 11f4c96e4dc4fbace1e7f5bd33b4e785 |
|
BLAKE2b-256 | c6a880355459c19146702daaa7ef55501a1a75876cfd6df553af98572189ca5c |