summaryrefslogtreecommitdiff
path: root/monkey
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2015-11-13 13:15:20 +0100
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2015-12-10 14:10:04 +0100
commit9f46298bd68cb22d88d377552274c8387bf4da3e (patch)
treeb916f536b6c66ec97e16d24363027e6da0dbbceb /monkey
parentf6ca33092fa10b3f4cffa688c0e47624d5ca287e (diff)
Remove unused monkey.action.compress
Diffstat (limited to 'monkey')
-rw-r--r--monkey/action.py51
1 files changed, 0 insertions, 51 deletions
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 = ''