From 9f46298bd68cb22d88d377552274c8387bf4da3e Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Fri, 13 Nov 2015 13:15:20 +0100 Subject: Remove unused monkey.action.compress --- monkey/action.py | 51 --------------------------------------------------- 1 file changed, 51 deletions(-) (limited to 'monkey') diff --git a/monkey/action.py b/monkey/action.py index 4ad0f6c..b8bbc40 100644 --- a/monkey/action.py +++ b/monkey/action.py @@ -170,54 +170,6 @@ def expand(actions): else: i += 1 -# each action in parse() result corresponds to single insertion/deletion. -# this function merges related adjacent actions -def compress(actions): - # first make each edit change exactly one character, for easier handling - expand(actions) - - i = 0 - while i < len(actions)-1: - a = actions[i] - b = actions[i+1] - - # merge adjacent INSERT actions - # +a +b → +ab - if a.type == 'insert' and b.type == 'insert' and \ - b.offset == a.offset + a.length: #and b.time - a.time < 10000: - a.text += b.text - a.length += b.length - del actions[i+1] - - # merge adjacent REMOVE actions (two cases: backspace & delete) - # -b -a → -ab - elif a.type == 'remove' and b.type == 'remove' and \ - b.offset == a.offset - b.length: #and b.time - a.time < 10000: - a.text = b.text + a.text - a.offset = b.offset - a.length += b.length - del actions[i+1] - # -a -b → -ab - elif a.type == 'remove' and b.type == 'remove' and \ - b.offset == a.offset and b.time - a.time < 10000: - a.text += b.text - a.length += b.length - del actions[i+1] - - # merge adjacent INSERT/REMOVE actions - # +ab -b → +a - elif a.type == 'insert' and b.type == 'remove' and \ - b.offset >= a.offset and b.offset < a.offset + a.length and \ - b.length == a.offset + a.length - b.offset and b.time - a.time < 10000: - del_start = b.offset - a.offset - del_end = del_start + b.length - a.text = a.text[:del_start] + a.text[del_end:] - a.length -= b.length - del actions[i+1] - - else: - i += 1 - # some sample code if __name__ == '__main__': import sys, os.path @@ -245,9 +197,6 @@ if __name__ == '__main__': try: actions = parse(attempt.trace) print('read ' + str(len(actions)) + ' actions from log') - compress(actions) - print('after compression: ' + str(len(actions)) + ' actions') - print() print('code versions for this attempt:') code = '' -- cgit v1.2.1