This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Yet another finite state automaton for python.

Introduction

The emphasis is on a simple, readable configuration:

automata1:
  start: Occupied
  states:
    Occupied: {}
    Alarmed: {}
  transitions:
    Occupied->Alarmed:
      when: house.presence.empty
    Occupied->Alarmed:
      when: house.presence.occupied

It’s particularly suited to home automation (my use case).

Example

For an example of using finite for home automation, see: test/test1.dfa.

Configuration

The configuration format is yaml.

Each automata has a start state, a set of states and a set of transitions:

automata1:
    start: Occupied
    states:
        Occupied:
            {}
        Alarmed:
            {}
    transitions:
        Occupied->Alarmed:
            when: house.presence.empty
        Occupied->Alarmed:
            when: house.presence.occupied

Transitions may have actions associated with them:

Occupied->Alarmed:
    when: house.presence.empty
    actions:
    - speak('Alarm activated')

These callbacks are called on the ‘callback’ object passed when make_world.

A yaml file may list multiple automaton:

automata1:
    start: State1
    states: ...
    transitions: ...

automata2:
    start: State2
    states: ...
    transitions: ...

Code

Example:

from finite import dfa

# create a callback
class Callback(object):
    def speak(self, msg):
        # do some speaking
        pass
callback = Callback()

# create automaton
worlds = dfa.Worlds()
automatons = dfa.Loader.load_file('my.dfa')
for aut in automatons:
    world = aut.make_world(callback)
    self.worlds.add(world)

# trigger a state change
ev = dfa.Event('house.presence.empty', True)
worlds.process(ev)

Changelog

0.1.0

  • First release
Release History

Release History

0.1.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
finite-0.1.0.tar.gz (6.8 kB) Copy SHA256 Checksum SHA256 Source Feb 23, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting