[Spambayes-checkins] spambayes dbdict.py,1.1.2.2,1.1.2.3
Tim Stone
timstone4@users.sourceforge.net
Thu Nov 21 02:58:58 2002
- Previous message: [Spambayes-checkins] spambayes Bayes.py,1.5.2.2,1.5.2.3
- Next message: [Spambayes-checkins]
spambayes Bayes.py,1.5.2.3,1.5.2.4 Options.py,1.72.2.3,1.72.2.4
classifier.py,1.53.2.1,1.53.2.2 hammiefilter.py,1.2.2.1,1.2.2.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/spambayes/spambayes
In directory sc8-pr-cvs1:/tmp/cvs-serv5722
Modified Files:
Tag: hammie-playground
dbdict.py
Log Message:
Removed LSDBDict class
Index: dbdict.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/dbdict.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
*** dbdict.py 20 Nov 2002 06:06:28 -0000 1.1.2.2
--- dbdict.py 21 Nov 2002 02:58:56 -0000 1.1.2.3
***************
*** 58,62 ****
except ImportError:
import pickle
!
import errno
import copy
--- 58,62 ----
except ImportError:
import pickle
!
import errno
import copy
***************
*** 143,201 ****
- class LSDBDict(DBDict):
- """Database Dictionary that supports Load/Store semantic."""
-
- def __init__(self, dbname, mode=MODE_CREATE, iterskip=()):
- '''Constructor, dbname, mode {c|n|r|w}, iteration skip tuple'''
-
- self.mode = mode
- self.dbname = dbname
- self.wdbname = self.dbname+'.working'
- self.iterskip = iterskip
-
- if self.mode == MODE_READWRITE or self.mode == MODE_CREATE:
- try:
- shutil.copyfile(self.dbname, self.wdbname)
- except (IOError, os.error), why:
- pass # don't blow up for now
- elif self.mode == MODE_READONLY:
- # for readonly access, use the real dbm file
- self.wdbname = self.dbname
- elif self.mode == MODE_NEW:
- try:
- os.unlink(self.wdbname)
- except OSError, e:
- if e.errno != errno.ENOENT:
- raise
- else:
- raise ValueError, "Mode must be MODE_CREATE, MODE_NEW, MODE_READONLY, or MODE_READWRITE"
-
- self.hash = dbhash.open(self.wdbname, self.mode)
-
-
- def store(self):
- '''store the working dbm into the 'real' dbm file'''
-
- if self.mode != MODE_READONLY:
- self.hash.close()
- shutil.copyfile(self.wdbname, self.dbname)
- self.hash = dbhash.open(self.wdbname, MODE_CREATE)
- else:
- raise error, 'Store operation not permitted on readonly dbm'
-
- def restore(self):
- '''restore the working dbm to the 'real' dbm condition'''
-
- if self.mode == MODE_READONLY:
- raise error, \
- 'Restore operation not permitted on readonly dbm'
- else:
- self.hash.close()
-
- if self.mode != MODE_NEW:
- shutil.copyfile(self.dbname, self.wdbname)
-
- self.hash = dbhash.open(self.wdbname, self.mode)
-
open = DBDict
--- 143,146 ----
- Previous message: [Spambayes-checkins] spambayes Bayes.py,1.5.2.2,1.5.2.3
- Next message: [Spambayes-checkins]
spambayes Bayes.py,1.5.2.3,1.5.2.4 Options.py,1.72.2.3,1.72.2.4
classifier.py,1.53.2.1,1.53.2.2 hammiefilter.py,1.2.2.1,1.2.2.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Spambayes-checkins
mailing list