class documentation
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 | __contains__ |
No summary |
Method | __delitem__ |
del dirdbm[foo] Delete a file in this directory. |
Method | __getitem__ |
dirdbm[k] Get the contents of a file in this directory as a string. |
Method | __init__ |
No summary |
Method | __len__ |
No summary |
Method | __setitem__ |
dirdbm[k] = v Create or modify a textfile in this directory |
Method | clear |
Delete all key/value pairs in this dirdbm. |
Method | close |
Close this dbm: no-op, for dbm-style interface compliance. |
Method | copy |
Copy the contents of this dirdbm to the dirdbm at path. |
Method | get |
No summary |
Method | get |
Returns modification time of an entry. |
Method | has |
No summary |
Method | items |
No summary |
Method | keys |
No summary |
Method | setdefault |
No summary |
Method | update |
Add all the key/value pairs in dict to this dirdbm. Any conflicting keys will be overwritten with the values from dict . |
Method | values |
No summary |
Instance Variable | dname |
Undocumented |
Method | _decode |
Decode a filename to get the key. |
Method | _encode |
Encode a key so it can be used as a filename. |
Method | _read |
Read in the contents of a file. |
Method | _write |
Write data to a file. |
Instance Variable | _dname |
Undocumented |
del dirdbm[foo] Delete a file in this directory.
Parameters | |
k:bytes | key to delete |
Raises | |
KeyError | Raised when there is no such key |
overridden in
twisted.persisted.dirdbm.Shelf
dirdbm[k] Get the contents of a file in this directory as a string.
Parameters | |
k:bytes | key to lookup |
Returns | |
The value associated with k | |
Raises | |
KeyError | Raised when there is no such key |
overridden in
twisted.persisted.dirdbm.Shelf
dirdbm[k] = v Create or modify a textfile in this directory
Parameters | |
k:bytes | key to set |
v:bytes | value to associate with k |
Copy the contents of this dirdbm to the dirdbm at path.
Parameters | |
path:str | The path of the dirdbm to copy to. If a dirdbm exists at the destination path, it is cleared first. |
Returns | |
DirDBM | The dirdbm this dirdbm was copied to. |
Parameters | |
key:bytes | The key to lookup |
default | The value to return if the given key does not exist |
Returns | |
The value associated with key or default if not DirDBM.has_key(key) |
Returns modification time of an entry.
Returns | |
Last modification date (seconds since epoch) of entry key | |
Raises | |
KeyError | Raised when there is no such key |
Parameters | |
key:bytes | The key to test |
Returns | |
A true value if this dirdbm has the specified key, a false value otherwise. |
Parameters | |
key:bytes | The key to lookup |
value | The value to associate with key if key is not already associated with a value. |
Read in the contents of a file.
Override in subclasses to e.g. provide transparently encrypted dirdbm.