clean up some more bsddb scraps

This commit is contained in:
Benjamin Peterson 2008-09-03 22:59:38 +00:00
parent c469d4c3aa
commit 6ba2332f55
4 changed files with 3 additions and 104 deletions

View File

@ -87,93 +87,6 @@ then prints out the contents of the database::
The individual submodules are described in the following sections.
:mod:`dbm.bsd` --- DBM-style interface to the BSD database library
------------------------------------------------------------------
.. module:: dbm.bsd
:synopsis: DBM-style interface to the BSD database library.
.. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
.. index:: module: bsddb
The :mod:`dbm.bsd` module provides a function to open databases using the BSD
``db`` library. This module mirrors the interface of the other Python database
modules that provide access to DBM-style databases. The :mod:`bsddb` module is
required to use :mod:`dbm.bsd`.
.. exception:: error
Exception raised on database errors other than :exc:`KeyError`. It is a synonym
for :exc:`bsddb.error`.
.. function:: open(path[, flag[, mode]])
Open a ``db`` database and return the database object. The *path* argument is
the name of the database file.
The *flag* argument can be:
+---------+-------------------------------------------+
| Value | Meaning |
+=========+===========================================+
| ``'r'`` | Open existing database for reading only |
| | (default) |
+---------+-------------------------------------------+
| ``'w'`` | Open existing database for reading and |
| | writing |
+---------+-------------------------------------------+
| ``'c'`` | Open database for reading and writing, |
| | creating it if it doesn't exist |
+---------+-------------------------------------------+
| ``'n'`` | Always create a new, empty database, open |
| | for reading and writing |
+---------+-------------------------------------------+
For platforms on which the BSD ``db`` library supports locking, an ``'l'``
can be appended to indicate that locking should be used.
The optional *mode* parameter is used to indicate the Unix permission bits that
should be set if a new database must be created; this will be masked by the
current umask value for the process.
The database objects returned by :func:`open` provide the methods common to all
the DBM-style databases and mapping objects. The following methods are
available in addition to the standard methods:
.. method:: dbhash.first()
It's possible to loop over every key/value pair in the database using this
method and the :meth:`next` method. The traversal is ordered by the databases
internal hash values, and won't be sorted by the key values. This method
returns the starting key.
.. method:: dbhash.last()
Return the last key/value pair in a database traversal. This may be used to
begin a reverse-order traversal; see :meth:`previous`.
.. method:: dbhash.next()
Returns the key next key/value pair in a database traversal. The following code
prints every key in the database ``db``, without having to create a list in
memory that contains them all::
print(db.first())
for i in range(1, len(db)):
print(db.next())
.. method:: dbhash.previous()
Returns the previous key/value pair in a forward-traversal of the database. In
conjunction with :meth:`last`, this may be used to implement a reverse-order
traversal.
.. method:: dbhash.sync()
This method forces any unwritten data to be written to the disk.
:mod:`dbm.gnu` --- GNU's reinterpretation of dbm
------------------------------------------------

View File

@ -9,9 +9,7 @@ The modules described in this chapter support storing Python data in a
persistent form on disk. The :mod:`pickle` and :mod:`marshal` modules can turn
many Python data types into a stream of bytes and then recreate the objects from
the bytes. The various DBM-related modules support a family of hash-based file
formats that store a mapping of strings to other strings. The :mod:`bsddb`
module also provides such disk-based string-to-string mappings based on hashing,
and also supports B-Tree and record-based formats.
formats that store a mapping of strings to other strings.
The list of modules described in this chapter is:
@ -23,5 +21,4 @@ The list of modules described in this chapter is:
shelve.rst
marshal.rst
dbm.rst
bsddb.rst
sqlite3.rst

View File

@ -1,11 +0,0 @@
"""Provide a (g)dbm-compatible interface to bsddb.hashopen."""
import bsddb
__all__ = ["error", "open"]
class error(bsddb.error, IOError):
pass
def open(file, flag = 'r', mode=0o666):
return bsddb.hashopen(file, flag, mode)

View File

@ -73,12 +73,12 @@ C API
Library
-------
- The bsddb module (and therefore the dbm.bsd module) has been removed.
- Issue 600362: Relocated parse_qs() and parse_qsl(), from the cgi module
to the urlparse one. Added a DeprecationWarning in the old module, it
will be deprecated in the future.
- The bsddb module has been removed.
- Issue #3719: platform.architecture() fails if there are spaces in the
path to the Python binary.