/Lib/dbhash.py

http://unladen-swallow.googlecode.com/ · Python · 19 lines · 13 code · 4 blank · 2 comment · 3 complexity · 1d0b5a24927c448b3fa353a4705b8be3 MD5 · raw file

  1. """Provide a (g)dbm-compatible interface to bsddb.hashopen."""
  2. import sys
  3. if sys.py3kwarning:
  4. import warnings
  5. warnings.warnpy3k("in 3.x, dbhash has been removed", DeprecationWarning, 2)
  6. try:
  7. import bsddb
  8. except ImportError:
  9. # prevent a second import of this module from spuriously succeeding
  10. del sys.modules[__name__]
  11. raise
  12. __all__ = ["error","open"]
  13. error = bsddb.error # Exported for anydbm
  14. def open(file, flag = 'r', mode=0666):
  15. return bsddb.hashopen(file, flag, mode)