summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmonkey/test.py35
1 files changed, 5 insertions, 30 deletions
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))