[Spambayes-checkins] spambayes/spambayes CoreUI.py, 1.1.2.2, 1.1.2.3
Skip Montanaro
montanaro at users.sourceforge.net
Tue May 22 05:05:14 CEST 2007
- Previous message: [Spambayes-checkins] spambayes/spambayes/core_resources README.txt, NONE, 1.1.2.1 README_txt.py, NONE, 1.1.2.1 __init__.py, NONE, 1.1.2.1 classify.gif, NONE, 1.1.2.1 classify_gif.py, NONE, 1.1.2.1 config.gif, NONE, 1.1.2.1 config_gif.py, NONE, 1.1.2.1 helmet.gif, NONE, 1.1.2.1 helmet_gif.py, NONE, 1.1.2.1 help.gif, NONE, 1.1.2.1 help_gif.py, NONE, 1.1.2.1 message.gif, NONE, 1.1.2.1 message_gif.py, NONE, 1.1.2.1 query.gif, NONE, 1.1.2.1 query_gif.py, NONE, 1.1.2.1 scanning__init__.py, NONE, 1.1.2.1 status.gif, NONE, 1.1.2.1 status_gif.py, NONE, 1.1.2.1 train.gif, NONE, 1.1.2.1 train_gif.py, NONE, 1.1.2.1 ui.html, NONE, 1.1.2.1 ui.psp, NONE, 1.1.2.1 ui_html.py, NONE, 1.1.2.1 ui_psp.py, NONE, 1.1.2.1
- Next message: [Spambayes-checkins] spambayes setup.py,1.32.2.1,1.32.2.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/spambayes/spambayes/spambayes
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv20756
Modified Files:
Tag: CORESVR
CoreUI.py
Log Message:
More PEP-8 reversions. Try to clean up the message info db stuff a little.
Enough for tonight. My head is swimming...
Index: CoreUI.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/Attic/CoreUI.py,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** CoreUI.py 21 May 2007 12:25:26 -0000 1.1.2.2
--- CoreUI.py 22 May 2007 03:05:12 -0000 1.1.2.3
***************
*** 779,782 ****
--- 779,796 ----
return errmsg
+ def readUIResources(self):
+ """Returns ui.html and a dictionary of Gifs."""
+ if self.lang_manager:
+ ui_html = self.lang_manager.import_ui_html()
+ else:
+ from spambayes.core_resources import ui_html
+ images = {}
+ for baseName in UserInterface.IMAGES:
+ moduleName = '%s.%s_gif' % ('spambayes.core_resources', baseName)
+ module = __import__(moduleName, {}, {}, ('spambayes',
+ 'core_resources'))
+ images[baseName] = module.data
+ return ui_html.data, images
+
class CoreState:
"""This keeps the global state of the module - the command-line options,
***************
*** 794,812 ****
self.prepared = False
self.can_stop = True
- self.mdb = None
! # Unique names for cached messages - see `get_new_message_name()` below.
self.last_base_message_name = ''
self.uniquifier = 2
# Set up the statistics.
! self.num_spams = 0
! self.num_hams = 0
! self.num_unsure = 0
self.servers = ""
- self.init()
-
# Load up the other settings from Option.py / bayescustomize.ini
self.ui_port = options["html_ui", "port"]
--- 808,823 ----
self.prepared = False
self.can_stop = True
! # Unique names for cached messages - see `getNewMessageName()` below.
self.last_base_message_name = ''
self.uniquifier = 2
# Set up the statistics.
! self.numSpams = 0
! self.numHams = 0
! self.numUnsure = 0
self.servers = ""
# Load up the other settings from Option.py / bayescustomize.ini
self.ui_port = options["html_ui", "port"]
***************
*** 816,836 ****
self.is_test = False
def init(self):
assert not self.prepared, "init after prepare, but before close"
! # Load the environment for translation.
! self.lang_manager = i18n.LanguageManager()
! # Set the system user default language.
! self.lang_manager.set_language(\
! self.lang_manager.locale_default_lang())
! # Set interface to use the user language in the configuration file.
! for language in reversed(options["globals", "language"]):
! # We leave the default in there as the last option, to fall
! # back on if necessary.
! self.lang_manager.add_language(language)
! if options["globals", "verbose"]:
! print "Asked to add languages: " + \
! ", ".join(options["globals", "language"])
! print "Set language to " + \
! str(self.lang_manager.current_langs_codes)
# Open the log file.
--- 827,851 ----
self.is_test = False
+ self.init()
+
def init(self):
assert not self.prepared, "init after prepare, but before close"
! ## no i18n yet...
! ## # Load the environment for translation.
! ## self.lang_manager = i18n.LanguageManager()
! ## # Set the system user default language.
! ## self.lang_manager.set_language(\
! ## self.lang_manager.locale_default_lang())
! ## # Set interface to use the user language in the configuration file.
! ## for language in reversed(options["globals", "language"]):
! ## # We leave the default in there as the last option, to fall
! ## # back on if necessary.
! ## self.lang_manager.add_language(language)
! ## if options["globals", "verbose"]:
! ## print "Asked to add languages: " + \
! ## ", ".join(options["globals", "language"])
! ## print "Set language to " + \
! ## str(self.lang_manager.current_langs_codes)
! self.lang_manager = None
# Open the log file.
***************
*** 849,857 ****
self.bayes.close()
self.bayes = None
! if self.mdb is not None:
! self.mdb.store()
! self.mdb.close()
! self.mdb = None
! spambayes.message.Message.message_info_db = None
self.spamCorpus = self.hamCorpus = self.unknownCorpus = None
--- 864,868 ----
self.bayes.close()
self.bayes = None
! spambayes.message.Message().message_info_db = None
self.spamCorpus = self.hamCorpus = self.unknownCorpus = None
***************
*** 931,938 ****
self.db_name, self.use_db = storage.database_type([])
self.bayes = storage.open_storage(self.db_name, self.use_db)
- self.mdb = spambayes.message.Message().message_info_db
# Load stats manager.
! self.stats = Stats.Stats(options, self.mdb)
self.build_status_strings()
--- 942,949 ----
self.db_name, self.use_db = storage.database_type([])
self.bayes = storage.open_storage(self.db_name, self.use_db)
# Load stats manager.
! self.stats = Stats.Stats(options,
! spambayes.message.Message().message_info_db)
self.build_status_strings()
***************
*** 978,982 ****
self.hamCorpus.addObserver(self.ham_trainer)
! def get_new_message_name(self):
"""The message name is the time it arrived with a uniquifier
appended if two arrive within one clock tick of each other.
--- 989,993 ----
self.hamCorpus.addObserver(self.ham_trainer)
! def getNewMessageName(self):
"""The message name is the time it arrived with a uniquifier
appended if two arrive within one clock tick of each other.
***************
*** 1000,1008 ****
"""
if cls == options["Headers", "header_ham_string"]:
! self.num_hams += 1
elif cls == options["Headers", "header_spam_string"]:
! self.num_spams += 1
else:
! self.num_unsure += 1
self.stats.recordClassification(score)
--- 1011,1019 ----
"""
if cls == options["Headers", "header_ham_string"]:
! self.numHams += 1
elif cls == options["Headers", "header_spam_string"]:
! self.numSpams += 1
else:
! self.numUnsure += 1
self.stats.recordClassification(score)
- Previous message: [Spambayes-checkins] spambayes/spambayes/core_resources README.txt, NONE, 1.1.2.1 README_txt.py, NONE, 1.1.2.1 __init__.py, NONE, 1.1.2.1 classify.gif, NONE, 1.1.2.1 classify_gif.py, NONE, 1.1.2.1 config.gif, NONE, 1.1.2.1 config_gif.py, NONE, 1.1.2.1 helmet.gif, NONE, 1.1.2.1 helmet_gif.py, NONE, 1.1.2.1 help.gif, NONE, 1.1.2.1 help_gif.py, NONE, 1.1.2.1 message.gif, NONE, 1.1.2.1 message_gif.py, NONE, 1.1.2.1 query.gif, NONE, 1.1.2.1 query_gif.py, NONE, 1.1.2.1 scanning__init__.py, NONE, 1.1.2.1 status.gif, NONE, 1.1.2.1 status_gif.py, NONE, 1.1.2.1 train.gif, NONE, 1.1.2.1 train_gif.py, NONE, 1.1.2.1 ui.html, NONE, 1.1.2.1 ui.psp, NONE, 1.1.2.1 ui_html.py, NONE, 1.1.2.1 ui_psp.py, NONE, 1.1.2.1
- Next message: [Spambayes-checkins] spambayes setup.py,1.32.2.1,1.32.2.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Spambayes-checkins
mailing list