summaryrefslogtreecommitdiff
path: root/monkey
diff options
context:
space:
mode:
Diffstat (limited to 'monkey')
-rw-r--r--monkey/__init__.py4
-rw-r--r--monkey/edits.py8
2 files changed, 6 insertions, 6 deletions
diff --git a/monkey/__init__.py b/monkey/__init__.py
index fbb4535..79dfe2d 100644
--- a/monkey/__init__.py
+++ b/monkey/__init__.py
@@ -16,7 +16,7 @@
import time
-from prolog.util import tokenize, rename_vars, stringify, parse, interesting_ranges, rename_vars_list
+from prolog.util import tokenize, stringify, parse, interesting_ranges, rename_vars_list
from .util import PQueue
# Starting from [code], find a sequence of edits that transforms it into a
@@ -33,7 +33,7 @@ def fix(code, edits, test, timeout=30, debug=False):
for (path, a, b), (p, uids) in edits.items():
if path == range_path and a == part_normal:
reverse_names = {v: k for k, v in names.items()}
- b_real = tuple(rename_vars(b, reverse_names))
+ b_real = tuple(rename_vars_list(b, reverse_names))
new_tokens = []
idx = None
for i, t in enumerate(tokens):
diff --git a/monkey/edits.py b/monkey/edits.py
index 73f692d..82e5066 100644
--- a/monkey/edits.py
+++ b/monkey/edits.py
@@ -18,7 +18,7 @@ import collections
import math
from .action import expand, parse
-from prolog.util import normalized, parse as prolog_parse, rename_vars, rename_vars_ast, rename_vars_list, interesting_ranges, stringify, tokenize
+from prolog.util import normalized, parse as prolog_parse, rename_vars_ast, rename_vars_list, interesting_ranges, stringify, tokenize
from .util import avg, logistic
def get_edits_from_trace(trace, test, id):
@@ -142,10 +142,10 @@ def get_edits_from_solutions(solutions, test):
# Update submission/query counters (use normalized variables).
for code, correct in trace_submissions:
- code = stringify(rename_vars(tokenize(code)))
+ code = stringify(rename_vars_list(tokenize(code)))
submissions[(code, correct)].add(uid)
for query in trace_queries:
- code = stringify(rename_vars(tokenize(query)))
+ code = stringify(rename_vars_list(tokenize(query)))
queries[code] += 1
# Discard edits that only occur in one trace.
@@ -232,7 +232,7 @@ if __name__ == '__main__':
if p.identifier in used_predicate_identifiers])
# Check for cached results.
- normal_code = stringify(rename_vars(tokenize(code)))
+ normal_code = stringify(rename_vars_list(tokenize(code)))
code_key = (normal_code, tuple(dependencies))
if code_key not in test_results[pid]:
aux_code = '\n' + solutions_for_problems(problem.language, dependencies) + '\n' + facts