[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[minion-cvs] Appease pychecker
Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.mit.edu:/tmp/cvs-serv19504/lib/mixminion
Modified Files:
ClientMain.py Common.py Packet.py benchmark.py test.py
Log Message:
Appease pychecker
Index: ClientMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ClientMain.py,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- ClientMain.py 7 Jul 2003 18:55:15 -0000 1.95
+++ ClientMain.py 8 Jul 2003 19:13:50 -0000 1.96
@@ -1335,7 +1335,7 @@
now = time.time()
cutoff = now - maxAge
remove = []
- for h in handles:
+ for h in self.getHandles():
when = self.getPacket(h)[2]
if when < cutoff:
remove.append(when)
@@ -2154,18 +2154,18 @@
sendUsageAndExit(cmd)
inFile = None
- headers = {}
+ h_subject = h_from = h_irt = h_references = None
for opt,val in options:
if opt in ('-i', '--input'):
inFile = val
elif opt == '--subject':
- headers["SUBJECT"] = val
+ h_subject = val
elif opt == '--from':
- headers["FROM"] = val
+ h_from = val
elif opt == '--in-reply-to':
- headers["IN-REPLY-TO"] = val
+ h_irt = val
elif opt == '--references':
- headers["REFERENCES"] = val
+ h_references = val
if args:
sendUsageAndExit(cmd,"Unexpected arguments")
@@ -2184,7 +2184,8 @@
# Encode the headers early so that we die before reading the message if
# they won't work.
- headerStr = encodeMessageHeaders(headers)
+ headerStr = encodeMailHeaders(subject=h_subject, fromAddr=h_from,
+ inReplyTo=h_irt, references=h_references)
if inFile in (None, '-') and '-' in parser.replyBlockFiles:
raise UIError(
@@ -2705,7 +2706,7 @@
print "ERROR: %s expects an integer" % o
sys.exit(1)
try:
- if count is None:
+ if days is None:
raise UsageError()
parser = CLIArgumentParser(options, wantConfig=1, wantLog=1,
wantClient=1)
Index: Common.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/Common.py,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -d -r1.97 -r1.98
--- Common.py 7 Jul 2003 16:49:24 -0000 1.97
+++ Common.py 8 Jul 2003 19:13:50 -0000 1.98
@@ -22,15 +22,12 @@
import cPickle
import errno
import fcntl
-import grp
import gzip
import os
-import pwd
import re
import signal
import stat
import statvfs
-import string
import sys
import threading
import time
Index: Packet.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/Packet.py,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- Packet.py 7 Jul 2003 18:55:15 -0000 1.49
+++ Packet.py 8 Jul 2003 19:13:50 -0000 1.50
@@ -684,7 +684,7 @@
headers['IN-REPLY-TO'] = inReplyTo
if references:
headers['REFERENCES'] = references
- return encodeMessageHeaders(message, headers)
+ return encodeMessageHeaders(headers)
def encodeMessageHeaders(headers):
"""DOCDOC dict
Index: benchmark.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/benchmark.py,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- benchmark.py 8 Jul 2003 18:38:24 -0000 1.43
+++ benchmark.py 8 Jul 2003 19:13:50 -0000 1.44
@@ -881,7 +881,6 @@
import mixminion.MMTPClient
#msg = "X" * 32 * 1024
- n = 0
server, listener, messagesIn, keyid = _getMMTPServer(1,port=(TEST_PORT+1))
#t = threading.Thread(None, testLeaks5_send,
# args=(keyid,))
@@ -897,7 +896,7 @@
import socket
- context = _getTLSContext(0)
+ #context = _getTLSContext(0)
i = 0
while 0:
@@ -996,8 +995,8 @@
while 1:
fec = _ml.FEC_generate(3,5)
chunks = [ fec.encode(i, inp) for i in xrange(5) ]
- dec = fec.decode([(i, chunks[i]) for i in xrange(2,5) ])
-
+ fec.decode([(i, chunks[i]) for i in xrange(2,5) ])
+
#----------------------------------------------------------------------
def timeAll(name, args):
if 0:
Index: test.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/test.py,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -d -r1.132 -r1.133
--- test.py 8 Jul 2003 18:38:25 -0000 1.132
+++ test.py 8 Jul 2003 19:13:50 -0000 1.133
@@ -853,8 +853,8 @@
inp = "".join(inpChunks)
outChunks = [ fec.encode(i, inpChunks) for i in xrange(n) ]
for i in xrange(n):
- if n < k:
- eq(outChunks[i], inChunks[i])
+ if i < k:
+ eq(outChunks[i], inpChunks[i])
eq(len(outChunks[i]), sz)
numberedChunks = [ (i, outChunks[i]) for i in xrange(n) ]
@@ -870,8 +870,33 @@
self.do_fec_test(3,5,10)
self.do_fec_test(10,20,1024)
self.do_fec_test(30,40,1024)
+ self.do_fec_test(30,40,1)
self.do_fec_test(3,4,128)
self.do_fec_test(3,3,2048)
+
+ def test_bad_fec(self):
+
+ self.assertRaises(_ml.FECError,_ml.FEC_generate,5,3)
+ self.assertRaises(_ml.FECError,_ml.FEC_generate,0,10)
+ self.assertRaises(_ml.FECError,_ml.FEC_generate,10,300)
+
+ r = getCommonPRNG()
+ fec = _ml.FEC_generate(3,5)
+ inp = [ r.getBytes(256) for i in xrange(3) ]
+ self.assertRaises(_ml.FECError,fec.encode, -1, inp)
+ self.assertRaises(_ml.FECError,fec.encode, 5, inp)
+ self.assertRaises(_ml.FECError,fec.encode, 1, inp[0:2])
+ self.assertRaises(_ml.FECError,fec.encode, 1, inp*2)
+ self.assertRaises(_ml.FECError,fec.encode, 1, inp[0:2]+[3])
+ self.assertRaises(_ml.FECError,fec.encode, 1, 5)
+
+ cInp = [ (i, fec.encode(i, inp)) for i in xrange(5) ]
+ fec.decode(cInp[2:5])
+ self.assertRaises(_ml.FECError,fec.decode, inp)
+ self.assertRaises(_ml.FECError,fec.decode, [1,2,3])
+ self.assertRaises(_ml.FECError,fec.decode, cInp)
+ self.assertRaises(_ml.FECError,fec.decode, cInp[:-1])
+ self.assertRaises(_ml.FECError,fec.decode, cInp[0:2]+[2,'x'])
#----------------------------------------------------------------------