[Spambayes-checkins] spambayes/contrib bulkgraph.py,1.1,1.2

T. Alexander Popiel popiel at users.sourceforge.net
Mon Jan 27 14:03:50 EST 2003


Update of /cvsroot/spambayes/spambayes/contrib
In directory sc8-pr-cvs1:/tmp/cvs-serv28696/spambayes/contrib

Modified Files:
	bulkgraph.py 
Log Message:
Some minor fixes to bulkgraph.py:
Lop off the first column of the graph (which wasn't getting god data, anyway)
Correct the text describing the arguments
Add a scale tothe bottom of the graph marked in months



Index: bulkgraph.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/contrib/bulkgraph.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** bulkgraph.py	23 Jan 2003 04:46:27 -0000	1.1
--- bulkgraph.py	27 Jan 2003 22:03:46 -0000	1.2
***************
*** 20,29 ****
          but much slower to load.  Recommended for use with pop3proxy and
          hammiesrv.
!     -g PATH
!         mbox or directory of known good messages (non-spam) to train on.
!         Can be specified more than once.
      -s PATH
!         mbox or directory of known spam messages to train on.
!         Can be specified more than once.
      -f
          force training, ignoring the trained header.  Use this if you
--- 20,29 ----
          but much slower to load.  Recommended for use with pop3proxy and
          hammiesrv.
!     -e PATH
!         directory of all messages (both ham and spam).
      -s PATH
!         directory of known spam messages to train on.  These should be
!         duplicates of messages in the everything folder.  Can be
!         specified more than once.
      -f
          force training, ignoring the trained header.  Use this if you
***************
*** 59,63 ****
  def row(value, spamday, hamday, unsureday):
      line = "%5d|" % value
!     for j in range((expire) // grouping, -1, -1):
          spamv = 0
          hamv = 0
--- 59,63 ----
  def row(value, spamday, hamday, unsureday):
      line = "%5d|" % value
!     for j in range(((expire) // grouping) - 1, -1, -1):
          spamv = 0
          hamv = 0
***************
*** 94,97 ****
--- 94,122 ----
      return line
  
+ def legend():
+     line = " " * 60
+     now = time.mktime(time.strptime(time.strftime("%d %b %Y"), "%d %b %Y"))
+     date = time.mktime(time.strptime(time.strftime("1 %b %Y"), "%d %b %Y"))
+     age = int(59 - ((now - date) // day // grouping))
+     if age >= 55:
+         line = line[:age] + time.strftime("| %b")
+     else:
+         line = line[:(age)] + "|" + line[(age+1):]
+         center = int((age + 59) // 2)
+         line = line[:center] + time.strftime("%b") + line[center+3:]
+     date = time.mktime(time.strptime(time.strftime("1 %b %Y", time.localtime(date - day * 2)), "%d %b %Y"))
+     newage = int(59 - ((now - date) // day // grouping))
+     while newage >= 0:
+         line = line[:newage] + "|" + line[newage+1:]
+         center = int((age + newage) // 2)
+         line = line[:center] + time.strftime("%b", time.localtime(date)) + line[center+3:]
+         age = newage
+         date = time.mktime(time.strptime(time.strftime("1 %b %Y", time.localtime(date - day * 2)), "%d %b %Y"))
+         newage = int(59 - ((now - date) // day // grouping))
+     if age >= 4:
+         center = int((age) // 2)
+         line = line[:center-2] + time.strftime("%b", time.localtime(date)) + line[center+1:]
+     return line
+ 
  def main():
      """Main program; parse options and go."""
***************
*** 230,233 ****
--- 255,259 ----
              print row(scale * j, spamday, hamday, unsureday)
          print "     +" + ('-' * 60)
+         print "      " + legend()
          print
  





More information about the Spambayes-checkins mailing list