A directory with a DBM interface.
This class presents a hash-like interface to a directory of small,
flat files. It can only use strings as keys or values.
Method Summary |
|
__init__ (self,
name)
|
|
__contains__ (self,
key)
key in dirdbm |
|
__delitem__ (self,
k)
del dirdbm[foo] Delete a file in this directory. |
|
__getitem__ (self,
k)
dirdbm[k] Get the contents of a file in this directory as
a string. |
|
__len__ (self)
Return the number of key/value pairs in this Shelf |
|
__setitem__ (self,
k,
v)
dirdbm[k] = v Create or modify a textfile in this
directory |
|
_decode (self,
k)
Decode a filename to get the key. |
|
_encode (self,
k)
Encode a key so it can be used as a filename. |
|
_readFile (self,
path)
Read in the contents of a file. |
|
_writeFile (self,
path,
data)
Write data to a file. |
|
clear (self)
Delete all key/value pairs in this dirdbm. |
|
close (self)
Close this dbm: no-op, for dbm-style interface compliance. |
DirDBM
|
copyTo (self,
path)
Copy the contents of this dirdbm to the dirdbm at
path . |
|
get (self,
key,
default)
Return the value associated with key or default if
not self.has_key(key) |
|
getModificationTime (self,
key)
Returns modification time of an entry. |
|
has_key (self,
key)
Return a true value if this dirdbm has the specified key, a faluse value
otherwise. |
|
items (self)
Return a list of 2-tuples containing key/value pairs. |
|
keys (self)
Return a list of filenames (keys). |
|
setdefault (self,
key,
value)
|
|
update (self,
dict)
Add all the key/value pairs in dict to this dirdbm. |
|
values (self)
Return a list of file-contents (values). |