diff options
author | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2015-11-04 14:53:45 +0100 |
---|---|---|
committer | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2015-11-04 14:53:45 +0100 |
commit | 08519a9884977b5a52bcac85ab24ff04f5988528 (patch) | |
tree | b70edd80335e0cb5b9e3279a4fd28ddfadc3c675 | |
parent | 1b69c74db2aba839354a5c8000d1ac86b46a7b8c (diff) |
Use correct type for prolog_solve action
-rwxr-xr-x | monkey/action.py | 10 |
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), } |