[Spambayes-checkins] spambayes/testtools mksets.py,1.6,1.7

Tim Peters tim_one at users.sourceforge.net
Sun Dec 28 20:27:34 EST 2003


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

Modified Files:
	mksets.py 
Log Message:
I'm not sure what the "# of groups" argument is good for here, but
because the code was splitting an entire path on "-", its idea of the
current file's group included the Ham/Set1, Ham/Set2, ..., prefix as
well as the "group number" from the basename.  That doesn't seem right.
Maybe it was, but if so it needed better docs cuz it's not that way
any more <wink>.


Index: mksets.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/testtools/mksets.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** mksets.py	29 Dec 2003 01:16:28 -0000	1.6
--- mksets.py	29 Dec 2003 01:27:32 -0000	1.7
***************
*** 47,51 ****
      files = [(os.path.basename(f), f) for f in files]
      files.sort()
-     files = [t[-1] for t in files]
  
      # Make sure all the desired Set directories exist, and a reservoir
--- 47,50 ----
***************
*** 70,75 ****
      cmess = 0
      cset = 1
!     for f in files:
!         newgroup = (f.split('-'))[0]
          if newgroup != oldgroup:
              oldgroup = newgroup
--- 69,74 ----
      cmess = 0
      cset = 1
!     for basename, f in files:
!         newgroup = basename.split('-')[0]
          if newgroup != oldgroup:
              oldgroup = newgroup
***************
*** 79,87 ****
          if ((ngroups is not None and cgroups > ngroups) or
              (nmess is not None and cmess > (nmess * nsets))):
!             newname = os.path.join(dir, "reservoir",
!                                    os.path.basename(f))
          else:
!             newname = os.path.join(dir, "Set%d" % cset,
!                                    os.path.basename(f))
              cset = (cset % nsets) + 1
          sys.stdout.write("%-78s\r" % ("Moving %s to %s" % (f, newname)))
--- 78,84 ----
          if ((ngroups is not None and cgroups > ngroups) or
              (nmess is not None and cmess > (nmess * nsets))):
!             newname = os.path.join(dir, "reservoir", basename)
          else:
!             newname = os.path.join(dir, "Set%d" % cset, basename)
              cset = (cset % nsets) + 1
          sys.stdout.write("%-78s\r" % ("Moving %s to %s" % (f, newname)))





More information about the Spambayes-checkins mailing list