[Spambayes-checkins] spambayes pop3proxy.py,1.90,1.91
Tony Meyer
anadelonbrin at users.sourceforge.net
Mon Aug 25 03:00:38 EDT 2003
- Previous message: [Spambayes-checkins] spambayes README.txt,1.50,1.51
- Next message: [Spambayes-checkins] spambayes/spambayes Options.py, 1.63,
1.64 OptionsClass.py, 1.10, 1.11 hammie.py, 1.5,
1.6 message.py, 1.31, 1.32 storage.py, 1.19, 1.20
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/spambayes/spambayes
In directory sc8-pr-cvs1:/tmp/cvs-serv2977
Modified Files:
pop3proxy.py
Log Message:
Fix some old option names.
Change notate_to and notate_subject options to tuples - if empty, do nothing
(like old False), otherwise if classification is in option value, then mutate the
header (old True meant only spam messages).
Add no_cache_large_messages option. If messages are bigger than this, don't
cache them (to avoid caching messages with massive attachments that are
already correctly classified).
Make pop3proxy and hammie use the storage.open_storage function.
Index: pop3proxy.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/pop3proxy.py,v
retrieving revision 1.90
retrieving revision 1.91
diff -C2 -d -r1.90 -r1.91
*** pop3proxy.py 18 Aug 2003 04:52:53 -0000 1.90
--- pop3proxy.py 25 Aug 2003 09:00:33 -0000 1.91
***************
*** 447,453 ****
len(args) == 2 and args[1] == '99999999')):
cls = msg.GetClassification()
! if cls == options["Hammie", "header_ham_string"]:
state.numHams += 1
! elif cls == options["Hammie", "header_spam_string"]:
state.numSpams += 1
else:
--- 447,453 ----
len(args) == 2 and args[1] == '99999999')):
cls = msg.GetClassification()
! if cls == options["Headers", "header_ham_string"]:
state.numHams += 1
! elif cls == options["Headers", "header_spam_string"]:
state.numSpams += 1
else:
***************
*** 457,469 ****
# "Precedence: list" ham if the options say so.
isSuppressedBulkHam = \
! (cls == options["Hammie", "header_ham_string"] and
options["pop3proxy", "no_cache_bulk_ham"] and
msg.get('precedence') in ['bulk', 'list'])
# Cache the message. Don't pollute the cache with test
# messages or suppressed bulk ham.
if (not state.isTest and
options["pop3proxy", "cache_messages"] and
! not isSuppressedBulkHam):
# Write the message into the Unknown cache.
message = state.unknownCorpus.makeMessage(msg.getId())
--- 457,475 ----
# "Precedence: list" ham if the options say so.
isSuppressedBulkHam = \
! (cls == options["Headers", "header_ham_string"] and
options["pop3proxy", "no_cache_bulk_ham"] and
msg.get('precedence') in ['bulk', 'list'])
+ # Suppress large messages if the options say so.
+ size_limit = options["pop3proxy",
+ "no_cache_large_messages"]
+ isTooBig = size_limit > 0 and \
+ len(messageText) > size_limit
+
# Cache the message. Don't pollute the cache with test
# messages or suppressed bulk ham.
if (not state.isTest and
options["pop3proxy", "cache_messages"] and
! not isSuppressedBulkHam and not isTooBig):
# Write the message into the Unknown cache.
message = state.unknownCorpus.makeMessage(msg.getId())
***************
*** 610,629 ****
filename = options["Storage", "persistent_storage_file"]
filename = os.path.expanduser(filename)
! if self.useDB:
! if '::' in filename:
! sql_types = {"pgsql" : storage.PGClassifier,
! "mysql" : storage.mySQLClassifier,
! }
! sql_type, rest = filename.split('::', 1)
! if sql_types.has_key(sql_type.lower()):
! self.bayes = sql_types[sql_type.lower()](filename)
! else:
! # yikes! raise some sort of NoSuchClassifierError
! pass
! else:
! self.bayes = storage.DBDictClassifier(filename)
! else:
! self.bayes = storage.PickledClassifier(filename)
! print "Done."
# Don't set up the caches and training objects when running the self-test,
--- 616,620 ----
filename = options["Storage", "persistent_storage_file"]
filename = os.path.expanduser(filename)
! self.bayes = storage.open_storage(filename, self.useDB)
# Don't set up the caches and training objects when running the self-test,
***************
*** 759,763 ****
def stop(state):
state.bayes.store()
! # should we be calling socket.shutdown(2) and close() for each
# BayesProxy object?
--- 750,754 ----
def stop(state):
state.bayes.store()
! # should we be calling socket.shutdown(2) and close_when_done() for each
# BayesProxy object?
- Previous message: [Spambayes-checkins] spambayes README.txt,1.50,1.51
- Next message: [Spambayes-checkins] spambayes/spambayes Options.py, 1.63,
1.64 OptionsClass.py, 1.10, 1.11 hammie.py, 1.5,
1.6 message.py, 1.31, 1.32 storage.py, 1.19, 1.20
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Spambayes-checkins
mailing list