minimalkv.decorator module¶
- class minimalkv.decorator.KeyTransformingDecorator(store: KeyValueStore)¶
Bases:
StoreDecorator- copy(source: str, dest: str)¶
- delete(key: str)¶
- get(key, *args, **kwargs)¶
- get_file(key: str, *args, **kwargs)¶
- iter_keys(prefix: str = '') Iterator[str]¶
- iter_prefixes(delimiter: str, prefix: str = '') Iterable[str]¶
- keys(prefix: str = '')¶
- open(key: str)¶
- put(key: str, *args, **kwargs)¶
- put_file(key: str, *args, **kwargs)¶
- url_for(key: str, *args, **kwargs) str¶
- class minimalkv.decorator.PrefixDecorator(prefix: str, store: KeyValueStore)¶
Bases:
KeyTransformingDecoratorPrefixes any key with a string before passing it on the decorated store.
Automatically strips the prefix upon key retrieval.
Parameters¶
- storeKeyValueStore
The store to pass keys on to.
- prefixstr
Prefix to add.
- class minimalkv.decorator.ReadOnlyDecorator(store: KeyValueStore)¶
Bases:
StoreDecoratorA read-only view of an underlying minimalkv store.
Provides only access to the following methods/attributes of the underlying store:
get,iter_keys,keys,open,get_fileand__contains__. Accessing any other method will raiseAttributeError.Note that the original store for read / write can still be accessed, so using this class as a wrapper only provides protection against bugs and other kinds of unintentional writes; it is not meant to be a real security measure.
- class minimalkv.decorator.StoreDecorator(store: KeyValueStore)¶
Bases:
objectBase class for store decorators.
The default implementation will use
getattr()to pass through all attribute/method requests to an underlying object stored as_dstore. It will also pass through the__getattr__and__contains__python special methods.Attributes¶
- _dstore: KeyValueStore
Store.
Parameters¶
- store: KeyValueStore
Store.
- close()¶
Relay a close call to the next decorator or underlying store.
- class minimalkv.decorator.URLEncodeKeysDecorator(store: KeyValueStore)¶
Bases:
KeyTransformingDecoratorURL-encodes keys before passing them on to the underlying store.