|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /proc/22697/root/usr/lib64/python2.4/ |
Upload File : |
mς
=5Dc @ sΟ d Z d e f d YZ d d d d g Z e g Z d Z xX e D]P Z y e e Z Wn e
j
o
qD n Xe p
e Z n e i e i qD We p e
d e n e e Z d d d
Z
d S( s! Generic interface to all dbm clones.
Instead of
import dbm
d = dbm.open(file, 'w', 0666)
use
import anydbm
d = anydbm.open(file, 'w')
The returned object is a dbhash, gdbm, dbm or dumbdbm object,
dependent on the type of database being opened (determined by whichdb
module) 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):
d[key] = data # store data at key (may override data at
# existing key)
data = d[key] # retrieve data at key (raise KeyError if no
# such key)
del d[key] # delete data stored at key (raises KeyError
# if no such key)
flag = key in d # true if the key exists
list = d.keys() # return a list of all existing keys (slow!)
Future versions may change the order in which implementations are
tested for existence, add interfaces to other dbm-like
implementations.
The open function has an optional second argument. This can be 'r',
for read-only access, 'w', for read-write access of an existing
database, 'c' for read-write access to a new or existing database, and
'n' for read-write access to a new database. The default is 'r'.
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.
t errorc B s t Z RS( N( t __name__t
__module__( ( ( t /usr/lib64/python2.4/anydbm.pyR - s t dbhasht gdbmt dbmt dumbdbms no dbm clone found; tried %st riΆ c C s d k l } | | } | d j o1 d | j p
d | j o
t } q} t d n' | d j o
t d n
t | } | i | | | S( N( s whichdbt ct ns# need 'c' or 'n' flag to open new dbt s db type could not be determined( t whichdbt filet resultt Nonet flagt _defaultmodt modR t
__import__t opent mode( R
R R R R R ( ( R R B s
N( t __doc__t ExceptionR t _namest _errorsR R t _nameR t _modt ImportErrort appendt tupleR ( R R R R R R R ( ( R t ?+ s"