[pypy-commit] extradoc extradoc: finetuning
hakanardo
noreply at buildbot.pypy.org
Fri Sep 14 14:20:34 CEST 2012
Author: Hakan Ardo <hakan at debian.org>
Branch: extradoc
Changeset: r4816:2054db02fd85
Date: 2012-09-14 13:29 +0200
http://bitbucket.org/pypy/extradoc/changeset/2054db02fd85/
Log: finetuning
diff --git a/talk/dls2012/demo/demo.py b/talk/dls2012/demo/demo.py
--- a/talk/dls2012/demo/demo.py
+++ b/talk/dls2012/demo/demo.py
@@ -14,8 +14,11 @@
self.send(c)
time.sleep(delay)
+ def close(self):
+ self.send('<ESC>:q!<CR>')
+
def __del__(self):
- self.send('<ESC>:q!<CR>')
+ self.close()
def pause(msg=''):
print "\n"
@@ -41,6 +44,7 @@
part2(vim, skip1)
runner.kill()
+ vim.close()
def part1(vim):
@@ -191,7 +195,7 @@
pause("It still seems to work as before. Now lets add the second pass")
vim.type('O<CR><BS><BS>for x, y in reversed(seg.indexes()):<CR>if seg[x, y]:<CR>ll = [labels[x, y], labels[x+1, y], labels[x-1, y+1],<CR>labels[x, y+1], labels[x+1, y+1]]<CR>labels.update(x, y, ll)<CR><ESC>:w<CR>', 0.01)
- pause("That's starting to look good, but in complicated cases we can still" +
+ pause("That's starting to look good, but in complicated cases we can still\n" +
"get multiple lables per segment, so we need to repeat until convergance")
vim.type('56ggVkkkkkkkkkk', 0.2)
vim.send('>')
@@ -201,8 +205,8 @@
pause("As a final touch, lets renumber the labels be consecutative\n" +
"integers.")
- vim.type('44ggo<CR>def renumber(self):<CR>ll = list(set(self.labels))<CR>ll.sort()<CR>if ll[0] != 0:<CR>ll.insert(0, 0)<CR><BS>for x, y in self.labels.indexes():<CR>self.labels[x, y] = ll.index(self.labels[x, y])<CR><BS>self.last_label = len(ll) - 1<ESC>', 0.01)
- vim.type('G72ggOlabels.renumber()<ESC>:w<CR>', 0.01)
+ vim.type('G63ggOlabels.renumber()<ESC>', 0.01)
+ vim.type('44ggo<CR>def renumber(self):<CR>ll = list(set(self.labels))<CR>ll.sort()<CR>if ll[0] != 0:<CR>ll.insert(0, 0)<CR><BS>for x, y in self.labels.indexes():<CR>self.labels[x, y] = ll.index(self.labels[x, y])<CR><BS>self.last_label = len(ll) - 1<ESC>:w<CR>', 0.01)
diff --git a/talk/dls2012/demo/detect.py b/talk/dls2012/demo/detect.py
--- a/talk/dls2012/demo/detect.py
+++ b/talk/dls2012/demo/detect.py
@@ -52,6 +52,25 @@
self.labels[x, y] = ll.index(self.labels[x, y])
self.last_label = len(ll) - 1
+ def renumber(self):
+ ll = list(set(self.labels))
+ ll.sort()
+ if ll[0] != 0:
+ ll.insert(0, 0)
+ for x, y in self.labels.indexes():
+ self.labels[x, y] = ll.index(self.labels[x, y])
+ self.last_label = len(ll) - 1
+
+ def renumber(self):
+ ll = list(set(self.labels))
+ ll.sort()
+ if ll[0] != 0:
+ ll.insert(0, 0)
+ for x, y in self.labels.indexes():
+ self.labels[x, y] = ll.index(self.labels[x, y])
+ self.last_label = len(ll) - 1
+ labels.renumber()
+
def bwlabel(seg):
labels = Labler(seg)
More information about the pypy-commit
mailing list