Skip to main content

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


Download files

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

Source Distribution

jlvandenhout-automaton-0.1.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jlvandenhout_automaton-0.1.0-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file jlvandenhout-automaton-0.1.0.tar.gz.

File metadata

  • Download URL: jlvandenhout-automaton-0.1.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.4

File hashes

Hashes for jlvandenhout-automaton-0.1.0.tar.gz
Algorithm Hash digest
SHA256 84003985db8933828deb297d794eea9a37df104ebb95d7ee1acca9ab5d1e5d78
MD5 d61a37d484264c17dfba8fe58905f159
BLAKE2b-256 7590e6fb13eb69c79f3c18ba560a9fb50b4b614333e72691e01603dd54f943de

See more details on using hashes here.

File details

Details for the file jlvandenhout_automaton-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: jlvandenhout_automaton-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.4

File hashes

Hashes for jlvandenhout_automaton-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f6281fcd41625272a1940fdc117de6a72045dff70054f3df99aeadda01cb05f
MD5 2041bef8942402f58581267deb4538f5
BLAKE2b-256 bde664bfde5da44ca14a71c5cb72a188ce78da7a401d19f7c986bd2212a3cf36

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page