A fine state machine
Project description
finesm
Installation
pip install finesm
Usage
from finesm import State, 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-1.0.0.tar.gz
(2.1 kB
view details)
Built Distribution
File details
Details for the file finesm-1.0.0.tar.gz
.
File metadata
- Download URL: finesm-1.0.0.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c1f780106ab4cad7100f2abdcf485a7278779e9d101cc68aeae7a59e8107b5e |
|
MD5 | e9a78493167ebab682d700b7dd87f020 |
|
BLAKE2b-256 | 007af5f62e8a0843f1aee356e886a1049d09e45b332f256b0484b0e41acf37eb |
File details
Details for the file finesm-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: finesm-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3cde691e83a00b8b70d76822b6382e94b164b0cc1db83559b03c9d7ba8f3e699 |
|
MD5 | b540c7920f150491ad0c20ecc1da56ca |
|
BLAKE2b-256 | 2f4daa428923218183cd4ecd7f846edd4958c67e8a9cdab924ee405914460caa |