From 1928e6b80bc04689c4add7070d98d98bfdc2100a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=2E=C3=87a=C4=9Flar=20Onur?= Date: Fri, 16 Sep 2005 06:56:36 +0000 Subject: [PATCH] =?UTF-8?q?G=C3=BCrersan'=C4=B1n=20de=C4=9Fi=C5=9Fiklikler?= =?UTF-8?q?i...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/repostats.py | 63 +++++++++++++++------------------------------- 1 file changed, 20 insertions(+), 43 deletions(-) diff --git a/tools/repostats.py b/tools/repostats.py index 0cd69005..e4bd9d33 100755 --- a/tools/repostats.py +++ b/tools/repostats.py @@ -32,58 +32,31 @@ def valuesort(x, y): return 1 -class Max: - def __init__(self, title, count): - self.list = {} - self.title = title - self.count = count - - def add(self, name, value): - list = {} - i = 0 - for x,y in self.list.items(): - if value > y: - list[name] = value - else: - list[x] = y - i += 1 - if i >= self.count: - break - if i < self.count: - list[name] = value - self.list = list - - def get_list(self): - items = self.list.items() - items.sort(valuesort) - return items - - def html_out(self): - echo(("

%s

" % self.title) % self.count) - for x,y in self.get_list(): - echo("" % (x, y)) - echo("
%s%s
") - - class Histogram: def __init__(self, title): self.list = {} self.title = title - def add(self, name): - if self.list.has_key(name): - self.list[name] = self.list[name] + 1 + def add(self, name, value=None): + if value: + self.list[name] = value else: - self.list[name] = 1 + if self.list.has_key(name): + self.list[name] = self.list[name] + 1 + else: + self.list[name] = 1 def get_list(self): items = self.list.items() items.sort(valuesort) return items - def html_out(self): + def html_out(self, max=0): echo("

%s

" % self.title) - for name,cnt in self.get_list(): + list = self.get_list() + if max != 0: + list = list[:max] + for name,cnt in list: echo("" % (name, cnt)) echo("
%s%s
") @@ -120,8 +93,8 @@ components = Histogram(_("Components")) dependencies = Histogram(_("Dependencies")) releases = Histogram(_("Releases")) types = Histogram(_("File types")) -mostpatched = Max(_("Top %d most patched source"), 5) -longpy = Max(_("Top %d longest action.py scripts"), 5) +mostpatched = Histogram(_("Top five most patched source")) +longpy = Histogram(_("Top five longest action.py scripts")) nr_binpaks = 0 nr_patches = 0 paknames = {} @@ -171,8 +144,8 @@ echo("") print "

Toplam %d kod paketi, ve bunlardan oluşturulacak %d ikili paket var.

" % (len(paks), nr_binpaks) echo(u"

Toplam peç sayısı %d

" % nr_patches) -mostpatched.html_out() -longpy.html_out() +mostpatched.html_out(5) +longpy.html_out(5) if errors != []: print "

Hatalar

" @@ -192,13 +165,17 @@ types.html_out() echo(_("

Dependencies
")) echo(_("package name with italics are not available in the repository

")) print "
" +notavail = 0 for name,cnt in dependencies.get_list(): if paknames.has_key(name): print "" % (name, cnt) else: + notavail += 1 print "" % (name, cnt) print "
%s%d
%s%d
" +print "

%d packages are not available in repository.

" % notavail + hosts.html_out() print ""