From 2566475184377b4fe10e96918b54747b9bc9ce73 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Tue, 13 Oct 2015 16:08:15 +0200 Subject: Remove unused code from monkey.action --- monkey/action.py | 57 +++++--------------------------------------------------- 1 file changed, 5 insertions(+), 52 deletions(-) (limited to 'monkey') diff --git a/monkey/action.py b/monkey/action.py index e894dfc..468e80b 100755 --- a/monkey/action.py +++ b/monkey/action.py @@ -68,52 +68,6 @@ def parse(data): time = 0 code = '' -# i = 0 -# while i < len(data): -# # parse one action -# type = data[i] -# i += 1 -# dt = int(((data[i] << 8) + (data[i+1])) * 100.0) -# time += dt -# i += 2 -# if type == 1: # insert -# offset = (data[i] << 8) + data[i+1] -# i += 2 -# length = (data[i] << 8) + data[i+1] -# i += 2 -# text = data[i:i+length].decode() -# i += length -# action = Action('insert', time, offset=offset, text=text) -# elif type == 2: # remove -# offset = (data[i] << 8) + data[i+1] -# i += 2 -# length = (data[i] << 8) + data[i+1] -# i += 2 -# text = code[offset:offset+length] -# action = Action('remove', time, offset=offset, text=text) -# elif type == 3 or type == 4: # solve / solve all -# length = (data[i] << 8) + data[i+1] -# i += 2 -# query = data[i:i+length].decode() -# i += length -# act_type = 'solve' + ('_all' if type == 4 else '') -# action = Action(act_type, time, text=query) -# elif type == 5: # next solution -# action = Action('next', time) -# elif type == 7: # stop/end -# action = Action('stop', time) -# elif type == 8: # test -# total = data[i] -# i += 1 -# passed = data[i] -# i += 1 -# action = Action('test', time, total=total, passed=passed) -# elif type == 9: # hint -# action = Action('hint', time) -# else: -# # unsupported action type -# continue - for packet in data: try: time += packet['dt'] @@ -253,16 +207,15 @@ if __name__ == '__main__': import sys, os.path sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/..') # the parent directory is the app directory - from db.models import Solution + from db.models import Problem, Solution # print all problem ids -# print('problems:') -# for problem in Problem.objects.all(): -# print(' {}\t{}'.format(problem.pk, problem.name)) -# print() + print('problems:') + for problem in Problem.list(): + print(' {}\t{}'.format(problem.id, problem.identifier)) + print() pid = input('enter problem id: ') -# problem = Problem.objects.get(pk=pid) # print all attempt ids for the selected problem print('users solving problem ' + str(pid) + ':') -- cgit v1.2.1