Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`persisted`.`dirdbm`.`Shelf``

class documentation

`class Shelf(DirDBM): (source)`

View In Hierarchy

A directory with a DBM shelf interface.

This class presents a hash-like interface to a directory of small, flat files. Keys must be strings, but values can be any given object.

Method | `__getitem__` | `dirdbm[foo]` Get and unpickle the contents of a file in this directory.
Method | `__setitem__` | `shelf[foo] = bar` Create or modify a textfile in this directory.

Inherited from `DirDBM`:

Method | `__contains__` | No summary
Method | `__delitem__` | `del dirdbm[foo]` Delete a file in this directory.
Method | `__init__` | No summary
Method | `__len__` | No summary
Method | `clear` | Delete all key/value pairs in this dirdbm.
Method | `close` | Close this dbm: no-op, for dbm-style interface compliance.
Method | `copyTo` | Copy the contents of this dirdbm to the dirdbm at `path`.
Method | `get` | No summary
Method | `getModificationTime` | Returns modification time of an entry.
Method | `has_key` | 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 | `_readFile` | Read in the contents of a file.
Method | `_writeFile` | Write data to a file.
Instance Variable | `_dnamePath` | Undocumented

def __getitem__(self, k): (source)
overrides `twisted.persisted.dirdbm.DirDBM.__getitem__`

`dirdbm[foo]` Get and unpickle the contents of a file in this directory.

Parameters
k:bytes | The key to lookup
Returns
The value associated with the given key
Raises
`KeyError` | Raised if the given key does not exist

def __setitem__(self, k, v): (source)
overrides `twisted.persisted.dirdbm.DirDBM.__setitem__`

`shelf[foo] = bar` Create or modify a textfile in this directory.

Parameters
k:str | The key to set
v | The value to associate with `key`