[Spambayes-checkins] spambayes/testtools mksets.py,1.2,1.3

Tim Peters tim_one at users.sourceforge.net
Sun Dec 28 20:03:06 EST 2003


Update of /cvsroot/spambayes/spambayes/testtools
In directory sc8-pr-cvs1:/tmp/cvs-serv11114

Modified Files:
	mksets.py 
Log Message:
INCOMPATIBLE CHANGE:  the -s option (set random seed) is gone.
sort+group.py recently went thru a lot of work to get the messages named
according to full-precision UTC received time.  This script was ignoring
everything except the "group number", though, and going out of its way
to randomize within a group.  Since the group number is derived from a
notion of number-of-days, message order was effectively randomized within
each 24-hour period.  Now no time-order info is destroyed.


Index: mksets.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/testtools/mksets.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** mksets.py	29 Dec 2003 00:57:47 -0000	1.2
--- mksets.py	29 Dec 2003 01:03:04 -0000	1.3
***************
*** 9,14 ****
      -h
          show usage and exit
-     -s num
-         random number seed
      -n num
          number of sets; default 5
--- 9,12 ----
***************
*** 25,29 ****
  import glob
  import shutil
- import random
  
  program = sys.argv[0]
--- 23,26 ----
***************
*** 43,54 ****
      sys.exit(code)
  
- def bybasename(a, b):
-     return cmp(os.path.basename(a).split("-", 2)[0],
-                os.path.basename(b).split("-", 2)[0])
- 
  def distribute(dir):
      files = glob.glob(os.path.join(dir, "*", "*"))
!     random.shuffle(files)
!     files.sort(bybasename)
  
      trash = glob.glob(os.path.join(dir, "Set*"))
--- 40,46 ----
      sys.exit(code)
  
  def distribute(dir):
      files = glob.glob(os.path.join(dir, "*", "*"))
!     files.sort()
  
      trash = glob.glob(os.path.join(dir, "Set*"))
***************
*** 104,108 ****
  
      try:
!         opts, args = getopt.getopt(sys.argv[1:], 'hs:n:g:m:')
      except getopt.error, msg:
          usage(2, msg)
--- 96,100 ----
  
      try:
!         opts, args = getopt.getopt(sys.argv[1:], 'hn:g:m:')
      except getopt.error, msg:
          usage(2, msg)
***************
*** 112,117 ****
              if opt == '-h':
                  usage(0)
-             elif opt == '-s':
-                 random.seed(int(arg))
              elif opt == '-n':
                  nsets = int(arg)
--- 104,107 ----





More information about the Spambayes-checkins mailing list