summaryrefslogtreecommitdiff
path: root/monkey
diff options
context:
space:
mode:
Diffstat (limited to 'monkey')
-rwxr-xr-xmonkey/action.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/monkey/action.py b/monkey/action.py
index 468e80b..1b036d6 100755
--- a/monkey/action.py
+++ b/monkey/action.py
@@ -9,11 +9,11 @@ class Action:
def __init__(self, type, time, offset=0, text='', total=0, passed=0):
self.type = type
self.time = time
- if type == 'insert' or type == 'remove':
+ if type in {'insert', 'remove'}:
self.offset = offset
self.length = len(text)
self.text = text
- elif type == 'solve' or type == 'solve_all':
+ elif type in {'prolog_solve', 'solve_all'}:
self.query = text
elif type == 'test':
self.total = total
@@ -21,9 +21,9 @@ class Action:
def __str__(self):
s = 't = ' + str(self.time/1000.0) + ' ' + self.type
- if self.type in ('insert', 'remove'):
+ if self.type in {'insert', 'remove'}:
s += ' "' + self.text.replace('\n', '\\n').replace('\t', '\\t') + '" at ' + str(self.offset)
- elif self.type in ('solve', 'solve_all'):
+ elif self.type in {'prolog_solve', 'solve_all'}:
s += ' "' + self.query + '"'
elif self.type == 'test':
s += ' {0} / {1}'.format(self.passed, self.total)
@@ -53,7 +53,7 @@ _packet_action_map = {
'tst': lambda packet, time, code: Action('test', time, total=packet['tot'], passed=packet['pas']),
'hnt': lambda packet, time, code: Action('hint', time),
'slva': lambda packet, time, code: Action('solve_all', time, text=packet['qry']),
- 'prolog_query': lambda packet, time, code: Action('prolog_query', time, text=packet['qry']),
+ 'prolog_solve': lambda packet, time, code: Action('prolog_solve', time, text=packet['query']),
'prolog_next': lambda packet, time, code: Action('next', time),
'prolog_end': lambda packet, time, code: Action('stop', time),
}