From f6ca33092fa10b3f4cffa688c0e47624d5ca287e Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Wed, 4 Nov 2015 14:45:36 +0100 Subject: Remove trace-graph function from monkey.test --- monkey/test.py | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) (limited to 'monkey') diff --git a/monkey/test.py b/monkey/test.py index 58989d8..bca55d8 100755 --- a/monkey/test.py +++ b/monkey/test.py @@ -21,7 +21,6 @@ import sys from termcolor import colored from db.models import CodeqUser, Problem, Solution -from .edits import classify_edits, trace_graph from .graph import graphviz from . import fix, fix_hints from prolog.util import annotate, compose, stringify @@ -135,15 +134,7 @@ elif sys.argv[2] == 'info': # Print all observed edits and their costs. elif sys.argv[3] == 'edits': - inserts, removes, changes = classify_edits(edits) - print('Inserts') - for after, cost in sorted(inserts.items(), key=lambda x: x[1]): - print(' {:.4f}\t{}'.format(cost, stringify(after))) - print('Removes') - for before, cost in sorted(removes.items(), key=lambda x: x[1]): - print(' {:.4f}\t{}'.format(cost, stringify(before))) - print('Changes') - for (before, after), cost in sorted(changes.items(), key=lambda x: x[1]): + for (before, after), cost in sorted(edits.items(), key=lambda x: x[1]): print(' {:.4f}\t{} → {}'.format(cost, stringify(before) if before else 'ε', stringify(after) if after else 'ε')) # Print all observed edits and their costs. @@ -156,23 +147,7 @@ elif sys.argv[2] == 'info': for query, count in queries.most_common(): print(' ' + str(count) + '\t' + query) -# Print the edit graph in graphviz dot syntax. -elif sys.argv[2] == 'graph' and len(sys.argv) == 4: - uid = int(sys.argv[3]) - solution = Solution.get(problem_id=problem.id, codeq_user_id=uid) - - nodes, submissions, queries = trace_graph(solution.trace) - - def position(node): - return (node.data[1]*150, node.data[0]*-60) - - def label(node): - return stringify(node.data[2]) - - def edge_attr(a, b): - if a.data[2] == b.data[2]: - return 'arrowhead="none"' - return '' - - graphviz_str = graphviz(nodes, pos=position, label=label, edge_attr=edge_attr) - print(graphviz_str) + # Print all student submissions and their counts. + elif sys.argv[3] == 'submissions': + for submission, count in submissions.most_common(): + print('{}\t{}'.format(count, submission)) -- cgit v1.2.1