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 details)
Built Distribution
File details
Details for the file finesm-0.0.0.tar.gz
.
File metadata
- Download URL: finesm-0.0.0.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
55291dae7d996ff67ba3d384fdf6734d0261fd8d3254fba2b978796bb936ff92
|
|
MD5 |
74367fd1c25c3f364019d87469ac6b9b
|
|
BLAKE2b-256 |
e9b430df9e7146ad4a14b338d89ab0cb2be3f652c21c9a370b5cbfb144f82a6c
|
File details
Details for the file finesm-0.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: finesm-0.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
a70c25d706b83e99ae312f01eac1a6ac36c97a24e00d90af6676c8f21d6bcc80
|
|
MD5 |
11f4c96e4dc4fbace1e7f5bd33b4e785
|
|
BLAKE2b-256 |
c6a880355459c19146702daaa7ef55501a1a75876cfd6df553af98572189ca5c
|