No project description provided
Project description
PyAutomaton
Description
PyAutomaton is a simple library implementing Mealy state machines, thus meaning that the events produced by the automaton are determined by the tuple (state, event) and not only on the current state, as happens with Moore state machines.
Usage
PyAutomaton offers the possibility of declare State Machines by using a fluent descriptive style.
For example, given the state machine in the following figure:
the code implementing this state machine is:
fsm = Automaton().start_from("locked").go_in("locked").when("push") \
.coming_from("locked").go_in("unlocked").when("coin") \
.coming_from("unlocked").go_in("unlocked").when("coin") \
.coming_from("unlocked").go_in("locked").when("push")
And the machine can run by invoking the fsm object as follow:
fsm('push')
each invocation triggers a state transition and returns the corresponding action, if any.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyautomaton-0.2.0.tar.gz.
File metadata
- Download URL: pyautomaton-0.2.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.1 CPython/3.8.13 Linux/5.15.0-47-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad539c19542d8c43c35aa8dbcb5d72e2e104c8cb1094ef3d335e86af3e816872
|
|
| MD5 |
a9a82e3fcbcff0a7de1dd0ced10b597d
|
|
| BLAKE2b-256 |
58da9e2526424c9a074b2cafa76e39ee21bf9c079c57b0410224fc4011cf42e3
|
File details
Details for the file pyautomaton-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pyautomaton-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.1 CPython/3.8.13 Linux/5.15.0-47-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0eb6ff376da60ac98e57399f8f9adff10db8ef7986766556e652dc48bc53479
|
|
| MD5 |
759911778a7ed245ef39221677f76858
|
|
| BLAKE2b-256 |
c5852ff4f708927bfc9e57c2f452d0604220a8fca3637ac3a08eaba1987223ab
|