[Python-checkins] python/nondist/sandbox/spambayes split.py,1.1,1.2
bwarsaw@users.sourceforge.net
bwarsaw@users.sourceforge.net
Tue, 20 Aug 2002 14:37:05 -0700
Update of /cvsroot/python/python/nondist/sandbox/spambayes
In directory usw-pr-cvs1:/tmp/cvs-serv2069
Modified Files:
split.py
Log Message:
Get rid of the -1 and -2 arguments and make them positional.
Index: split.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/split.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** split.py 20 Aug 2002 21:18:29 -0000 1.1
--- split.py 20 Aug 2002 21:37:01 -0000 1.2
***************
*** 7,11 ****
E.g.
! % split.py -1 mbox20 -2 mbox80 20 sourcembox
yields two mbox files, where mbox20 contains approximately 20% of the messages
--- 7,11 ----
E.g.
! % split.py mbox20 mbox80 20 sourcembox
yields two mbox files, where mbox20 contains approximately 20% of the messages
***************
*** 13,28 ****
randomly.
! Usage: %(programs)s -1 file -2 file [options] percent sourcembox
Options:
-h / --help
Print this help message and exit
! -1 file
! Names the first output file. Approximately percent % of the messages
! from the original source file will end up in this collection.
! -2 file
! Names the second output file. Approximately 100-percent % of the
! messages from the original source file will end up in this
! collection.
percent is a floating point number between 1 and 99. sourcembox is a Unix
--- 13,24 ----
randomly.
! Usage: %(programs)s [options] file1 file2 percent sourcembox
Options:
-h / --help
Print this help message and exit
!
! file1 and file2 are where the output goes. Approximately percent % of
! messages will go to file1 and (100 - percent) % of messages will go to file2.
percent is a floating point number between 1 and 99. sourcembox is a Unix
***************
*** 58,62 ****
def main():
try:
! opts, args = getopt.getopt(sys.argv[1:], 'h1:2:', ['help'])
except getopt.error, msg:
usage(1, msg)
--- 54,58 ----
def main():
try:
! opts, args = getopt.getopt(sys.argv[1:], 'h', ['help'])
except getopt.error, msg:
usage(1, msg)
***************
*** 66,83 ****
if opt in ('-h', '--help'):
usage(0)
- elif opt == '-1':
- bin1 = arg
- elif opt == '-2':
- bin2 = arg
-
- if bin1 is None or bin2 is None:
- usage(1, 'Both options -1 and -2 are required')
try:
! percent = float(args[0])
if not (0 < percent < 100):
raise ValueError
percent /= 100.0
! mboxfile = args[1]
except IndexError:
usage(1, 'Not enough arguments')
--- 62,74 ----
if opt in ('-h', '--help'):
usage(0)
try:
! bin1 = args[0]
! bin2 = args[1]
! percent = float(args[2])
if not (0 < percent < 100):
raise ValueError
percent /= 100.0
! mboxfile = args[3]
except IndexError:
usage(1, 'Not enough arguments')