diff options
Diffstat (limited to 'Lib/dbm')
| -rw-r--r-- | Lib/dbm/__init__.py | 23 | ||||
| -rw-r--r-- | Lib/dbm/dumb.py | 4 |
2 files changed, 9 insertions, 18 deletions
diff --git a/Lib/dbm/__init__.py b/Lib/dbm/__init__.py index 99c1637..6e890f3 100644 --- a/Lib/dbm/__init__.py +++ b/Lib/dbm/__init__.py @@ -5,12 +5,11 @@ Use import dbm d = dbm.open(file, 'w', 0o666) -The returned object is a dbm.bsd, dbm.gnu, dbm.ndbm or dbm.dumb -object, dependent on the type of database being opened (determined by -the whichdb function) in the case of an existing dbm. If the dbm does -not exist and the create or new flag ('c' or 'n') was specified, the -dbm type will be determined by the availability of the modules (tested -in the above order). +The returned object is a dbm.gnu, dbm.ndbm or dbm.dumb object, dependent on the +type of database being opened (determined by the whichdb function) in the case +of an existing dbm. If the dbm does not exist and the create or new flag ('c' +or 'n') was specified, the dbm type will be determined by the availability of +the modules (tested in the above order). It has the following interface (key and data are strings): @@ -36,7 +35,7 @@ Note: 'r' and 'w' fail if the database doesn't exist; 'c' creates it only if it doesn't exist; and 'n' always creates a new database. """ -__all__ = ['open', 'whichdb', 'error', 'error'] +__all__ = ['open', 'whichdb', 'error'] import io import os @@ -47,7 +46,7 @@ import sys class error(Exception): pass -_names = ['dbm.bsd', 'dbm.gnu', 'dbm.ndbm', 'dbm.dumb'] +_names = ['dbm.gnu', 'dbm.ndbm', 'dbm.dumb'] _defaultmod = None _modules = {} @@ -168,10 +167,6 @@ def whichdb(filename): if magic == 0x13579ace: return "dbm.gnu" - ## Check for old Berkeley db hash file format v2 - #if magic in (0x00061561, 0x61150600): - # return "bsddb185" # not supported anymore - # Later versions of Berkeley db hash file have a 12-byte pad in # front of the file type try: @@ -179,10 +174,6 @@ def whichdb(filename): except struct.error: return "" - ## Check for BSD hash - #if magic in (0x00061561, 0x61150600): - # return "dbm.bsd" - # Unknown return "" diff --git a/Lib/dbm/dumb.py b/Lib/dbm/dumb.py index 4d804da..cfb9123 100644 --- a/Lib/dbm/dumb.py +++ b/Lib/dbm/dumb.py @@ -203,7 +203,7 @@ class _Database(collections.MutableMapping): # The blocks used by the associated value are lost. del self._index[key] # XXX It's unclear why we do a _commit() here (the code always - # XXX has, so I'm not changing it). _setitem__ doesn't try to + # XXX has, so I'm not changing it). __setitem__ doesn't try to # XXX keep the directory file in synch. Why should we? Or # XXX why shouldn't __setitem__? self._commit() @@ -232,7 +232,7 @@ class _Database(collections.MutableMapping): __del__ = close - def _chmod (self, file): + def _chmod(self, file): if hasattr(self._os, 'chmod'): self._os.chmod(file, self._mode) |
