[Spambayes-checkins] spambayes/spambayes Stats.py,1.13,1.14

Tony Meyer anadelonbrin at users.sourceforge.net
Wed Dec 29 07:19:41 CET 2004


Update of /cvsroot/spambayes/spambayes/spambayes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1717/spambayes

Modified Files:
	Stats.py 
Log Message:
Skip messages that don't have a modified date - for Outlook, this will make no difference
 for anyone except people using code from CVS for the last few weeks.  For others,
 this means that the stats will be refreshed when starting to use 1.1, but that's
 ok, really.

Clean up another function.

Index: Stats.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/Stats.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** Stats.py	22 Dec 2004 00:25:45 -0000	1.13
--- Stats.py	29 Dec 2004 06:19:38 -0000	1.14
***************
*** 117,123 ****
              self.messageinfo_db.load_msg(m)
  
              # Skip ones that are too old.
!             if self.from_date and m.date_modified and \
!                m.date_modified < self.from_date:
                  continue
  
--- 117,126 ----
              self.messageinfo_db.load_msg(m)
  
+             # Skip all old messages that don't have a date.
+             if m.date_modified is None:
+                 continue
+ 
              # Skip ones that are too old.
!             if self.from_date and m.date_modified < self.from_date:
                  continue
  
***************
*** 150,167 ****
      def _CombineSessionAndTotal(self):
          totals = self.totals
!         num_seen = self.num_ham + self.num_spam + self.num_unsure + \
!                    totals["num_ham"] + totals["num_spam"] + \
!                    totals["num_unsure"]
!         num_ham = self.num_ham + totals["num_ham"]
!         num_spam = self.num_spam + totals["num_spam"]
!         num_unsure = self.num_unsure + totals["num_unsure"]
!         num_trained_ham = self.num_trained_ham + totals["num_trained_ham"]
!         num_trained_ham_fp = self.num_trained_ham_fp + \
!                              totals["num_trained_ham_fp"]
!         num_trained_spam = self.num_trained_spam + \
!                            totals["num_trained_spam"]
!         num_trained_spam_fn = self.num_trained_spam_fn + \
!                               totals["num_trained_spam_fn"]
!         return locals()
  
      def _CalculateAdditional(self, data):
--- 153,171 ----
      def _CombineSessionAndTotal(self):
          totals = self.totals
!         data = {}
!         data["num_ham"] = self.num_ham + totals["num_ham"]
!         data["num_spam"] = self.num_spam + totals["num_spam"]
!         data["num_unsure"] = self.num_unsure + totals["num_unsure"]
!         data["num_seen"] = data["num_ham"] + data["num_spam"] + \
!                            data["num_unsure"]
!         data["num_trained_ham"] = self.num_trained_ham + \
!                                   totals["num_trained_ham"]
!         data["num_trained_ham_fp"] = self.num_trained_ham_fp + \
!                                      totals["num_trained_ham_fp"]
!         data["num_trained_spam"] = self.num_trained_spam + \
!                                    totals["num_trained_spam"]
!         data["num_trained_spam_fn"] = self.num_trained_spam_fn + \
!                                       totals["num_trained_spam_fn"]
!         return data
  
      def _CalculateAdditional(self, data):



More information about the Spambayes-checkins mailing list