[Spambayes-checkins] SF.net SVN: spambayes:[3214] trunk/spambayes/scripts

montanaro at users.sourceforge.net montanaro at users.sourceforge.net
Tue Nov 25 05:01:34 CET 2008


Revision: 3214
          http://spambayes.svn.sourceforge.net/spambayes/?rev=3214&view=rev
Author:   montanaro
Date:     2008-11-25 04:01:34 +0000 (Tue, 25 Nov 2008)

Log Message:
-----------
pylint nits, use hashlib, use safepickle functions

Modified Paths:
--------------
    trunk/spambayes/scripts/core_server.py
    trunk/spambayes/scripts/sb_bnserver.py
    trunk/spambayes/scripts/sb_client.py
    trunk/spambayes/scripts/sb_dbexpimp.py
    trunk/spambayes/scripts/sb_imapfilter.py
    trunk/spambayes/scripts/sb_mailsort.py
    trunk/spambayes/scripts/sb_mboxtrain.py
    trunk/spambayes/scripts/sb_notesfilter.py
    trunk/spambayes/scripts/sb_pop3dnd.py
    trunk/spambayes/scripts/sb_server.py
    trunk/spambayes/scripts/sb_upload.py
    trunk/spambayes/scripts/sb_xmlrpcserver.py

Modified: trunk/spambayes/scripts/core_server.py
===================================================================
--- trunk/spambayes/scripts/core_server.py	2008-11-25 03:56:06 UTC (rev 3213)
+++ trunk/spambayes/scripts/core_server.py	2008-11-25 04:01:34 UTC (rev 3214)
@@ -94,11 +94,9 @@
  o Graphs.  Of something.  Who cares what?
 """
 
-import sys, getopt, time
-from email.Header import Header
+import sys, getopt
 
 from spambayes import Dibbler
-from spambayes import storage
 from spambayes.Options import options, _
 from spambayes.UserInterface import UserInterfaceServer
 from spambayes.Version import get_current_version

Modified: trunk/spambayes/scripts/sb_bnserver.py
===================================================================
--- trunk/spambayes/scripts/sb_bnserver.py	2008-11-25 03:56:06 UTC (rev 3213)
+++ trunk/spambayes/scripts/sb_bnserver.py	2008-11-25 04:01:34 UTC (rev 3214)
@@ -27,7 +27,7 @@
         unix domain socket used on which we listen    
 """
 
-import os, getopt, sys, SocketServer, time, traceback, select, socket, errno
+import os, getopt, sys, SocketServer, traceback, select, socket, errno
 
 try:
     True, False
@@ -63,7 +63,7 @@
     try:
         server = BNServer(args[0], BNRequest)
     except socket.error,e:
-        if e[0]==errno.EADDRINUSE:
+        if e[0] == errno.EADDRINUSE:
             pass   # in use, no need
         else:
             raise  # a real error
@@ -108,7 +108,7 @@
             pass
     
     def get_request(self):
-        r,w,e = select.select([self.socket], [], [], self.timeout)
+        r, w, e = select.select([self.socket], [], [], self.timeout)
         if r:
             return self.socket.accept()
         else:
@@ -119,15 +119,16 @@
         switches = self.rfile.readline()
         body = self.rfile.read()
         try:
-            response = self._calc_response(switches,body)
+            response = self._calc_response(switches, body)
             self.wfile.write('0\n%d\n'%(len(response),))
             self.wfile.write(response)
         except:
-            response = traceback.format_exception_only(sys.exc_info()[0],sys.exc_info()[1])[0]
+            response = traceback.format_exception_only(sys.exc_info()[0],
+                                                       sys.exc_info()[1])[0]
             self.wfile.write('1\n%d\n'%(len(response),))
             self.wfile.write(response)
        
-    def _calc_response(self,switches,body):
+    def _calc_response(self, switches, body):
         switches = switches.split()
         actions = []
         opts, args = getopt.getopt(switches, 'fgstGS')

Modified: trunk/spambayes/scripts/sb_client.py
===================================================================
--- trunk/spambayes/scripts/sb_client.py	2008-11-25 03:56:06 UTC (rev 3213)
+++ trunk/spambayes/scripts/sb_client.py	2008-11-25 04:01:34 UTC (rev 3214)
@@ -10,7 +10,7 @@
 import xmlrpclib
 import sys
 
-RPCBASE="http://localhost:65000"
+RPCBASE = "http://localhost:65000"
 
 def main():
     msg = sys.stdin.read()

Modified: trunk/spambayes/scripts/sb_dbexpimp.py
===================================================================
--- trunk/spambayes/scripts/sb_dbexpimp.py	2008-11-25 03:56:06 UTC (rev 3213)
+++ trunk/spambayes/scripts/sb_dbexpimp.py	2008-11-25 04:01:34 UTC (rev 3214)
@@ -101,8 +101,7 @@
 
 import spambayes.storage
 from spambayes.Options import options
-import sys, os, getopt, errno, re
-import urllib
+import sys, os, getopt, errno
 from types import UnicodeType
 
 def uquote(s):
@@ -137,8 +136,8 @@
 
     writer = csv.writer(fp)
 
-    nham = bayes.nham;
-    nspam = bayes.nspam;
+    nham = bayes.nham
+    nspam = bayes.nspam
 
     print "Exporting database %s to file %s" % (dbFN, outFN)
     print "Database has %s ham, %s spam, and %s words" \
@@ -215,7 +214,7 @@
     try:
         opts, args = getopt.getopt(sys.argv[1:], 'iehmvd:p:f:o:')
     except getopt.error, msg:
-        print >>sys.stderr, str(msg) + '\n\n' + __doc__
+        print >> sys.stderr, str(msg) + '\n\n' + __doc__
         sys.exit()
 
     useDBM = "pickle"
@@ -227,7 +226,7 @@
 
     for opt, arg in opts:
         if opt == '-h':
-            print >>sys.stderr, __doc__
+            print >> sys.stderr, __doc__
             sys.exit()
         elif opt == '-f':
             flatFN = arg
@@ -247,4 +246,4 @@
         if imp:
             runImport(dbFN, useDBM, newDBM, flatFN)
     else:
-        print >>sys.stderr, __doc__
+        print >> sys.stderr, __doc__

Modified: trunk/spambayes/scripts/sb_imapfilter.py
===================================================================
--- trunk/spambayes/scripts/sb_imapfilter.py	2008-11-25 03:56:06 UTC (rev 3213)
+++ trunk/spambayes/scripts/sb_imapfilter.py	2008-11-25 04:01:34 UTC (rev 3214)
@@ -110,7 +110,7 @@
     else:
         temp_dir = win32api.GetTempPath()
         status = "Log file opened in " + temp_dir
-    for i in range(3,0,-1):
+    for i in range(3, 0, -1):
         try:
             os.unlink(os.path.join(temp_dir, "SpamBayesIMAP%d.log" % (i+1)))
         except os.error:
@@ -132,20 +132,15 @@
 import getopt
 import types
 import thread
-import traceback
 import email
 import email.Parser
 from getpass import getpass
 from email.Utils import parsedate
-try:
-    import cStringIO as StringIO
-except ImportError:
-    import StringIO
 
 from spambayes import Stats
 from spambayes import message
-from spambayes.Options import options, get_pathname_option, optionsPathname
-from spambayes import tokenizer, storage, Dibbler
+from spambayes.Options import options, optionsPathname
+from spambayes import storage, Dibbler
 from spambayes.UserInterface import UserInterfaceServer
 from spambayes.ImapUI import IMAPUserInterface, LoginFailure
 
@@ -177,7 +172,6 @@
 
     timeout = 60 # seconds
     def __init__(self, server, debug=0, do_expunge = options["imap", "expunge"] ):
-
         if server.find(':') > -1:
             server, port = server.split(':', 1)
             port = int(port)
@@ -494,7 +488,7 @@
 
 class IMAPMessage(message.SBHeaderMessage):
     def __init__(self):
-        message.Message.__init__(self)
+        message.SBHeaderMessage.__init__(self)
         self.folder = None
         self.previous_folder = None
         self.rfc822_command = "(BODY.PEEK[])"
@@ -548,7 +542,7 @@
             # Can't select the folder, so getting the substance will not
             # work.
             self.could_not_retrieve = True
-            print >>sys.stderr, "Could not select folder %s for message " \
+            print >> sys.stderr, "Could not select folder %s for message " \
                   "%s (uid %s)" % (self.folder.name, self.id, self.uid)
             return self
 
@@ -571,7 +565,7 @@
             # characters for classification.  For now, we just carry on,
             # warning the user and ignoring the message.
             self.could_not_retrieve = True
-            print >>sys.stderr, "MemoryError with message %s (uid %s)" % \
+            print >> sys.stderr, "MemoryError with message %s (uid %s)" % \
                   (self.id, self.uid)
             return self
 
@@ -614,7 +608,7 @@
             self.got_substance = True
 
             # Print the exception and a traceback.
-            print >>sys.stderr, details
+            print >> sys.stderr, details
 
             return self            
 
@@ -660,7 +654,7 @@
         We can't actually update the message with IMAP, so what we do is
         create a new message and delete the old one."""
 
-        assert self.folder is not None,\
+        assert self.folder is not None, \
                "Can't save a message that doesn't have a folder."
         assert self.id, "Can't save a message that doesn't have an id."
         assert self.imap_server, "Can't do anything without IMAP connection."
@@ -733,7 +727,8 @@
             data = self.imap_server.check_response("recent", response)
             if data[0] is not None:
                 if options["globals", "verbose"]:
-                        print "[imapfilter] found saved message %s in iteration" % self.uid, i
+                    print "[imapfilter] found saved message", self.uid,
+                    print "in iteration", i
                 break
         else:
             if options["globals", "verbose"]:
@@ -963,7 +958,7 @@
             cls = msg.GetClassification()
             if cls is None or hamfolder is not None:
                 if options["globals", "verbose"]:
-                    print "[imapfilter] classified as %s:"%cls, msg.uid
+                    print "[imapfilter] classified as %s:" % cls, msg.uid
                 
                 msg = msg.get_full_message()
                 if msg.could_not_retrieve:
@@ -1140,13 +1135,13 @@
         for u in usernames:
             pwds.append(getpass("Enter password for %s:" % (u,)))
             
-    return zip(servers,usernames,pwds)
+    return zip(servers, usernames, pwds)
             
 def run(force_UI=False):
     try:
         opts, args = getopt.getopt(sys.argv[1:], 'hbPtcvl:e:i:d:p:o:')
     except getopt.error, msg:
-        print >>sys.stderr, str(msg) + '\n\n' + __doc__
+        print >> sys.stderr, str(msg) + '\n\n' + __doc__
         sys.exit()
 
     doTrain = False
@@ -1159,7 +1154,7 @@
 
     for opt, arg in opts:
         if opt == '-h':
-            print >>sys.stderr, __doc__
+            print >> sys.stderr, __doc__
             sys.exit()
         elif opt == "-b":
             launchUI = True
@@ -1248,7 +1243,7 @@
                                               IMAPSession, stats=stats,
                                               close_db=close_db,
                                               change_db=change_db))
-        launchBrowser=launchUI or options["html_ui", "launch_browser"]
+        launchBrowser = launchUI or options["html_ui", "launch_browser"]
         if sleepTime:
             # Run in a separate thread, as we have more work to do.
             thread.start_new_thread(Dibbler.run, (),

Modified: trunk/spambayes/scripts/sb_mailsort.py
===================================================================
--- trunk/spambayes/scripts/sb_mailsort.py	2008-11-25 03:56:06 UTC (rev 3213)
+++ trunk/spambayes/scripts/sb_mailsort.py	2008-11-25 04:01:34 UTC (rev 3214)
@@ -25,7 +25,7 @@
 import time
 import signal
 import socket
-import email
+import errno
 
 DB_FILE = os.path.expanduser(DB_FILE)
 
@@ -65,7 +65,7 @@
         try:
             fd = os.open(pathname, os.O_WRONLY|os.O_CREAT|os.O_EXCL, 0600)
         except IOError, exc:
-            if exc[i] not in (errno.EINT, errno.EEXIST):
+            if exc[0] not in (errno.EINT, errno.EEXIST):
                 raise
         else:
             break
@@ -142,7 +142,7 @@
     prob, evidence = bayes.spamprob(tokenize(msg), evidence=True)
     print msg_name, prob
     for word, prob in evidence:
-        print '  ', `word`, prob
+        print '  ', repr(word), prob
 
 def main():
     global DB_FILE, CONFIG_FILE

Modified: trunk/spambayes/scripts/sb_mboxtrain.py
===================================================================
--- trunk/spambayes/scripts/sb_mboxtrain.py	2008-11-25 03:56:06 UTC (rev 3213)
+++ trunk/spambayes/scripts/sb_mboxtrain.py	2008-11-25 04:01:34 UTC (rev 3214)
@@ -111,7 +111,8 @@
 def maildir_train(h, path, is_spam, force, removetrained):
     """Train bayes with all messages from a maildir."""
 
-    if loud: print "  Reading %s as Maildir" % (path,)
+    if loud:
+        print "  Reading %s as Maildir" % (path,)
 
     import time
     import socket
@@ -162,7 +163,8 @@
 def mbox_train(h, path, is_spam, force):
     """Train bayes with a Unix mbox"""
 
-    if loud: print "  Reading as Unix mbox"
+    if loud:
+        print "  Reading as Unix mbox"
 
     import mailbox
     import fcntl
@@ -219,7 +221,8 @@
 def mhdir_train(h, path, is_spam, force):
     """Train bayes with an mh directory"""
 
-    if loud: print "  Reading as MH mailbox"
+    if loud:
+        print "  Reading as MH mailbox"
 
     import glob
 
@@ -331,13 +334,15 @@
     h = hammie.open(pck, usedb, "c")
 
     for g in good:
-        if loud: print "Training ham (%s):" % g
+        if loud:
+            print "Training ham (%s):" % g
         train(h, g, False, force, trainnew, removetrained)
         sys.stdout.flush()
         save = True
 
     for s in spam:
-        if loud: print "Training spam (%s):" % s
+        if loud:
+            print "Training spam (%s):" % s
         train(h, s, True, force, trainnew, removetrained)
         sys.stdout.flush()
         save = True

Modified: trunk/spambayes/scripts/sb_notesfilter.py
===================================================================
--- trunk/spambayes/scripts/sb_notesfilter.py	2008-11-25 03:56:06 UTC (rev 3213)
+++ trunk/spambayes/scripts/sb_notesfilter.py	2008-11-25 04:01:34 UTC (rev 3214)
@@ -144,14 +144,15 @@
         return not not val
 
 import sys
-from spambayes import tokenizer, storage
-from spambayes.Options import options
-import cPickle as pickle
 import errno
+import getopt
+
 import win32com.client
 import pywintypes
-import getopt
 
+from spambayes import tokenizer, storage
+from spambayes.Options import options
+from spambayes.safepickle import pickle_read, pickle_write
 
 def classifyInbox(v, vmoveto, bayes, ldbname, notesindex, log):
 
@@ -187,20 +188,18 @@
                 # probably due to this unicode problem.
                 options["Tokenizer", "generate_long_skips"] = False
                 tokens = tokenizer.tokenize(message)
-                prob, clues = bayes.spamprob(tokens, evidence=True)
+                prob = bayes.spamprob(tokens)
 
                 if prob < options["Categorization", "ham_cutoff"]:
-                    disposition = options["Headers", "header_ham_string"]
                     numham += 1
                 elif prob > options["Categorization", "spam_cutoff"]:
-                    disposition = options["Headers", "header_spam_string"]
                     docstomove += [doc]
                     numspam += 1
                 else:
-                    disposition = options["Headers", "header_unsure_string"]
                     numuns += 1
 
                 notesindex[nid] = 'classified'
+                subj = message["subject"]
                 try:
                     print "%s spamprob is %s" % (subj[:30], prob)
                     if log:
@@ -305,16 +304,13 @@
     bayes = storage.open_storage(bdbname, useDBM)
 
     try:
-        fp = open(idxname, 'rb')
+        notesindex = pickle_read(idxname)
     except IOError, e:
         if e.errno != errno.ENOENT:
             raise
         notesindex = {}
         print "%s file not found, this is a first time run" % (idxname,)
         print "No classification will be performed"
-    else:
-        notesindex = pickle.load(fp)
-        fp.close()
 
     need_replicate = False
 
@@ -378,9 +374,7 @@
 
     bayes.store()
 
-    fp = open(idxname, 'wb')
-    pickle.dump(notesindex, fp)
-    fp.close()
+    pickle_write(idxname, notesindex)
 
     if log:
         log.LogAction("Finished running spambayes")
@@ -390,7 +384,7 @@
     try:
         opts, args = getopt.getopt(sys.argv[1:], 'htcPd:p:l:r:f:o:i:W:L:')
     except getopt.error, msg:
-        print >>sys.stderr, str(msg) + '\n\n' + __doc__
+        print >> sys.stderr, str(msg) + '\n\n' + __doc__
         sys.exit()
 
     ldbname = None  # local notes database name
@@ -405,7 +399,7 @@
 
     for opt, arg in opts:
         if opt == '-h':
-            print >>sys.stderr, __doc__
+            print >> sys.stderr, __doc__
             sys.exit()
         elif opt == '-l':
             ldbname = arg
@@ -437,9 +431,6 @@
             sbfname, doTrain, doClassify, pwd, idxname, logname)
 
         if doPrompt:
-            try:
-                key = input("Press Enter to end")
-            except SyntaxError:
-                pass
+            raw_input("Press Enter to end ")
     else:
-        print >>sys.stderr, __doc__
+        print >> sys.stderr, __doc__

Modified: trunk/spambayes/scripts/sb_pop3dnd.py
===================================================================
--- trunk/spambayes/scripts/sb_pop3dnd.py	2008-11-25 03:56:06 UTC (rev 3213)
+++ trunk/spambayes/scripts/sb_pop3dnd.py	2008-11-25 04:01:34 UTC (rev 3214)
@@ -64,16 +64,17 @@
 import os
 import re
 import sys
-import md5
+try:
+    from hashlib import md5
+except ImportError:
+    from md5 import new as md5
 import time
 import errno
-import types
 import email
 import thread
 import getopt
 import socket
 import imaplib
-import operator
 import email.Utils
 
 try:
@@ -85,14 +86,12 @@
 import twisted.application.app
 from twisted.internet import defer
 from twisted.internet import reactor
-from twisted.internet.defer import maybeDeferred
 from twisted.internet.protocol import ServerFactory
 from twisted.protocols.imap4 import IMessage
-from twisted.protocols.imap4 import parseNestedParens, parseIdList
-from twisted.protocols.imap4 import IllegalClientResponse, IAccount
-from twisted.protocols.imap4 import collapseNestedLists, MessageSet
+from twisted.protocols.imap4 import IAccount
+from twisted.protocols.imap4 import MessageSet
 from twisted.protocols.imap4 import IMAP4Server, MemoryAccount, IMailbox
-from twisted.protocols.imap4 import IMailboxListener, collapseNestedLists
+from twisted.protocols.imap4 import IMailboxListener
 
 from spambayes import storage
 from spambayes import message
@@ -101,7 +100,7 @@
 from spambayes.tokenizer import tokenize
 from spambayes import FileCorpus, Dibbler
 from spambayes.Version import get_current_version
-from sb_server import POP3ProxyBase, State, _addressPortStr, _recreateState
+from sb_server import POP3ProxyBase, State, _addressPortStr
 
 def ensureDir(dirname):
     """Ensure that the given directory exists - in other words, if it
@@ -263,7 +262,7 @@
             if part.get_main_type() == "text":
                 part_s.append(str(part.as_string().count("\n")))
             if ext:
-                part_s.extend([md5.new(part.as_string()).digest(),
+                part_s.extend([md5(part.as_string()).digest(),
                                part.get('Content-Disposition'),
                                part.get('Content-Language')])
             s.append(part_s)
@@ -538,7 +537,7 @@
 class SpambayesInbox(SpambayesMailbox):
     """A special mailbox that holds status messages from SpamBayes."""
     def __init__(self, id, state):
-        IMAPMailbox.__init__(self, "INBOX", "spambayes", id)
+        SpambayesMailbox.__init__(self, "INBOX", "spambayes", id)
         self.mdb = state.mdb
         self.UID_validity = id
         self.nextUID = 1
@@ -826,8 +825,8 @@
                 msg = email.message_from_string(messageText,
                                                 _class=message.SBHeaderMessage)
                 # Now find the spam disposition and add the header.
-                (prob, clues) = state.bayes.spamprob(msg.tokenize(),\
-                                 evidence=True)
+                (prob, clues) = state.bayes.spamprob(msg.tokenize(),
+                                                     evidence=True)
 
                 # Note that the X-SpamBayes-MailID header will be worthless
                 # because we don't know the message id at this point.  It's
@@ -870,7 +869,7 @@
                              message.insert_exception_header(messageText)
 
                 # Print the exception and a traceback.
-                print >>sys.stderr, details
+                print >> sys.stderr, details
             retval = ok + "\n" + messageText
             if terminatingDotPresent:
                 retval += '.\r\n'
@@ -1009,12 +1008,12 @@
     try:
         opts, args = getopt.getopt(sys.argv[1:], 'ho:')
     except getopt.error, msg:
-        print >>sys.stderr, str(msg) + '\n\n' + __doc__
+        print >> sys.stderr, str(msg) + '\n\n' + __doc__
         sys.exit()
 
     for opt, arg in opts:
         if opt == '-h':
-            print >>sys.stderr, __doc__
+            print >> sys.stderr, __doc__
             sys.exit()
         elif opt == '-o':
             options.set_from_cmdline(arg, sys.stderr)

Modified: trunk/spambayes/scripts/sb_server.py
===================================================================
--- trunk/spambayes/scripts/sb_server.py	2008-11-25 03:56:06 UTC (rev 3213)
+++ trunk/spambayes/scripts/sb_server.py	2008-11-25 04:01:34 UTC (rev 3214)
@@ -102,16 +102,15 @@
  o NNTP proxy.
 """
 
-import os, sys, re, errno, getopt, time, traceback, socket, cStringIO, email
+import sys, re, getopt, time, socket, email
 from thread import start_new_thread
-from email.Header import Header
 
 import spambayes.message
 from spambayes import i18n
 from spambayes import Stats
 from spambayes import Dibbler
 from spambayes import storage
-from spambayes.FileCorpus import FileCorpus, ExpiryFileCorpus
+from spambayes.FileCorpus import ExpiryFileCorpus
 from spambayes.FileCorpus import FileMessageFactory, GzipFileMessageFactory
 from spambayes.Options import options, get_pathname_option, _
 from spambayes.UserInterface import UserInterfaceServer
@@ -191,7 +190,7 @@
                 except socket.sslerror, why:
                     if why[0] == 1: # error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol'
                         # Probably not SSL after all.
-                        print >>sys.stderr, "Can't use SSL"
+                        print >> sys.stderr, "Can't use SSL"
                     else:
                         raise
                 else:
@@ -367,8 +366,7 @@
             raise SystemExit
         elif verb == 'CRASH':
             # For testing
-            x = 0
-            y = 1/x
+            raise ZeroDivisionError
 
         self.serverSocket.push(self.request + '\r\n')
         if self.request.strip() == '':
@@ -568,8 +566,8 @@
                       _class=spambayes.message.SBHeaderMessage)
             msg.setId(state.getNewMessageName())
             # Now find the spam disposition and add the header.
-            (prob, clues) = state.bayes.spamprob(msg.tokenize(),\
-                             evidence=True)
+            (prob, clues) = state.bayes.spamprob(msg.tokenize(),
+                                                 evidence=True)
 
             msg.addSBHeaders(prob, clues)
 
@@ -632,7 +630,7 @@
                                    insert_exception_header(messageText)
 
             # Print the exception and a traceback.
-            print >>sys.stderr, details
+            print >> sys.stderr, details
 
         # Restore the +OK and the POP3 .\r\n terminator if there was one.
         retval = ok + "\n" + messageText
@@ -836,7 +834,6 @@
         nham = self.bayes.nham
         if nspam > 10 and nham > 10:
             db_ratio = nham/float(nspam)
-            big = small = None
             if db_ratio > 5.0:
                 self.warning = _("Warning: you have much more ham than " \
                                  "spam - SpamBayes works best with " \
@@ -988,8 +985,6 @@
         proxyListeners.append(listener)
 
 def _recreateState():
-    global state
-
     # Close the existing listeners and create new ones.  This won't
     # affect any running proxies - once a listener has created a proxy,
     # that proxy is then independent of it.
@@ -1057,13 +1052,12 @@
     try:
         opts, args = getopt.getopt(sys.argv[1:], 'hbd:p:l:u:o:')
     except getopt.error, msg:
-        print >>sys.stderr, str(msg) + '\n\n' + __doc__
+        print >> sys.stderr, str(msg) + '\n\n' + __doc__
         sys.exit()
 
-    runSelfTest = False
     for opt, arg in opts:
         if opt == '-h':
-            print >>sys.stderr, __doc__
+            print >> sys.stderr, __doc__
             sys.exit()
         elif opt == '-b':
             state.launchUI = True
@@ -1096,14 +1090,14 @@
         try:
             prepare()
         except AlreadyRunningException:
-            print  >>sys.stderr, \
+            print  >> sys.stderr, \
                    "ERROR: The proxy is already running on this machine."
-            print  >>sys.stderr, "Please stop the existing proxy and try again"
+            print  >> sys.stderr, "Please stop the existing proxy and try again"
             return
         start()
 
     else:
-        print >>sys.stderr, __doc__
+        print >> sys.stderr, __doc__
 
 if __name__ == '__main__':
     run()

Modified: trunk/spambayes/scripts/sb_upload.py
===================================================================
--- trunk/spambayes/scripts/sb_upload.py	2008-11-25 03:56:06 UTC (rev 3213)
+++ trunk/spambayes/scripts/sb_upload.py	2008-11-25 04:01:34 UTC (rev 3214)
@@ -58,7 +58,7 @@
     h.putheader('content-length', str(len(body)))
     h.endheaders()
     h.send(body)
-    errcode, errmsg, headers = h.getreply()
+    h.getreply()
     return h.file.read()
 
 def encode_multipart_formdata(fields, files):
@@ -153,7 +153,7 @@
                                 ("text", "")],
                                [("file", "message.dat", data)])
             else:
-                post_multipart("%s:%d" % (server,port), "/upload", [],
+                post_multipart("%s:%d" % (server, port), "/upload", [],
                                [('file', 'message.dat', data)])
         except:
             # not an error if the server isn't responding

Modified: trunk/spambayes/scripts/sb_xmlrpcserver.py
===================================================================
--- trunk/spambayes/scripts/sb_xmlrpcserver.py	2008-11-25 03:56:06 UTC (rev 3213)
+++ trunk/spambayes/scripts/sb_xmlrpcserver.py	2008-11-25 04:01:34 UTC (rev 3214)
@@ -22,10 +22,8 @@
         Port number to listen to.
 """
 
-import os
 import getopt
 import sys
-import traceback
 import xmlrpclib
 import SimpleXMLRPCServer
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the Spambayes-checkins mailing list