Commit 2bfa878a authored by Stefan Behnel's avatar Stefan Behnel

Py3 fixes

parent e1939379
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#======================================================================= #=======================================================================
import sys import sys
from sys import maxint
from Transitions import TransitionMap from Transitions import TransitionMap
...@@ -117,6 +116,8 @@ class Node(object): ...@@ -117,6 +116,8 @@ class Node(object):
if action is not None: if action is not None:
file.write(" %s [priority %d]\n" % (action, priority)) file.write(" %s [priority %d]\n" % (action, priority))
def __lt__(self, other):
return self.number < other.number
class FastMachine(object): class FastMachine(object):
""" """
...@@ -167,7 +168,7 @@ class FastMachine(object): ...@@ -167,7 +168,7 @@ class FastMachine(object):
def make_initial_state(self, name, state): def make_initial_state(self, name, state):
self.initial_states[name] = state self.initial_states[name] = state
def add_transitions(self, state, event, new_state): def add_transitions(self, state, event, new_state, maxint=sys.maxint):
if type(event) is tuple: if type(event) is tuple:
code0, code1 = event code0, code1 = event
if code0 == -maxint: if code0 == -maxint:
......
...@@ -110,6 +110,7 @@ class TransitionMap(object): ...@@ -110,6 +110,7 @@ class TransitionMap(object):
if set: if set:
result.append((event, set)) result.append((event, set))
return iter(result) return iter(result)
items = iteritems
# ------------------- Private methods -------------------- # ------------------- Private methods --------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment