system.indexes.indexes module

Simple index implementation backed by a Python dictionary.

class system.indexes.indexes.PythonDictionaryIndex[source]

Bases: KeyValueStore, Generic

A simple key-value store implemented using a Python dictionary (yes, a Python dictionary is a key/value store). Supports duplicates by mapping a key to a list of Values, i.e. multiple values can be associated with the same key.

size() → int[source]

See Index.size().

put(key: Key, value: Value) → PutInfo | None[source]

See Index.put().

Appends the value to the list stored for the key, so duplicates are kept rather than overwritten.

delete(key: Key, value: Value = None) → None[source]

See Index.delete().

Removes the given value from the list stored for the key and drops the key entirely once its last value has been removed. Raises KeyError if the key or the value is not present.

flush(key: Key | None = None) → None[source]

See Index.flush().

No-op: a Python dictionary lives in volatile memory and is not backed by persistent storage. Raises KeyError if the given key is not present.

show() → None[source]

See Index.show().

Prints the underlying dictionary.

get(key: Key) → Iterator[source]

See PointQueryMixIn.get().

Raises KeyError if the key is not present.