Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

This package provides a simple automaton implementation for Python.

Project description

Automaton

This package provides a simple automaton implementation for Python.



1. Installation

1.1. Using pip

Simply run the usual installation command for pip:

pip install jlvandenhout-automaton

1.2. From source

To install from the latest source code, clone this repository and install from the repository:

git clone https://gitlab.com/jlvandenhout/automaton.git
cd automaton
pip install .

2. Basic usage

from random import choices

from jlvandenhout.automaton import Automaton
from jlvandenhout.graph import Graph


graph = Graph()
graph.edges.set("ice", "water", "heat")
graph.edges.set("water", "vapor", "heat")
graph.edges.set("vapor", "vapor", "heat")
graph.edges.set("vapor", "water", "cool")
graph.edges.set("water", "ice", "cool")
graph.edges.set("ice", "ice", "cool")

def follow(edge, symbol=None):
    return symbol == edge.get()

automaton = Automaton(graph, choices(list(graph.nodes)), graph.nodes, follow)

print("We start with", automaton.nodes.pop())
for symbol in choices(list(automaton.symbols), k=10):
    automaton.update(symbol)
    print(f"After {symbol}ing we have", automaton.nodes.pop())

3. Support

If you have any questions, suggestions or found a bug, please open an issue in the issue tracker.

4. Contributing

Refer to CONTRIBUTING.

5. License

Refer to GNU General Public License v3 (GPLv3).

6. Changelog

Refer to CHANGELOG.

Project details


Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for jlvandenhout-automaton, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size jlvandenhout_automaton-0.1.0-py3-none-any.whl (15.5 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size jlvandenhout-automaton-0.1.0.tar.gz (2.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page