[Spambayes-checkins] spambayes TestDriver.py,1.8,1.9

Brad Clements bkc@users.sourceforge.net
Mon, 23 Sep 2002 15:41:06 -0700


Update of /cvsroot/spambayes/spambayes
In directory usw-pr-cvs1:/tmp/cvs-serv3177

Modified Files:
	TestDriver.py 
Log Message:
allow global ham and spam histogram to be saved to a binary pickle


Index: TestDriver.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/TestDriver.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** TestDriver.py	23 Sep 2002 21:19:08 -0000	1.8
--- TestDriver.py	23 Sep 2002 22:41:04 -0000	1.9
***************
*** 165,168 ****
--- 165,176 ----
          if options.show_histograms:
              printhist("all runs:", self.global_ham_hist, self.global_spam_hist)
+ 
+         if options.save_histogram_pickles:
+             for f, h in (('ham', self.global_ham_hist), ('spam', self.global_spam_hist)):
+                 fname = "%s_%shist.pik" % (options.pickle_basename, f)
+                 print "    saving %s histogram pickle to %s" %(f, fname)
+                 fp = file(fname, 'wb')
+                 pickle.dump(h, fp, 1)
+                 fp.close()
  
      def test(self, ham, spam):