def viewloclist(model): t = html.table() d = model.counter.file2numlines paths = d.items() paths.sort(lambda x, y: -cmp(x[1], y[1])) # sort by numlines for p, numlines in paths: if numlines < 3: continue t.append(row(p.relto(pypydir.dirpath()), numlines)) return t
def viewsubdirs(model): t = html.table() for p in pypydir.listdir(): if p.basename in '_cache .svn'.split(): continue if p.check(dir=1): counter = countloc.FileCounter() counter.addrecursive(p, isfile, recpypy) model = CounterModel(counter) t.append(row(html.h2(p.relto(pypydir.dirpath())))) t.append(viewlocsummary(model)) t.append(viewloclist(model)) return t