[core] Add "Store" interface

Add an interface that allows arbitrary objects to store/retrieve
arbitrary key/value pairs. This will be used for different purposes in
the future:

* Config class(es) can store user-defined parameters for modules
* Widgets can store state
* ???

see #23
This commit is contained in:
Tobi-wan Kenobi 2016-12-09 07:41:07 +01:00
parent a7e756e015
commit c8a51b416f
2 changed files with 42 additions and 0 deletions

18
bumblebee/store.py Normal file
View file

@ -0,0 +1,18 @@
"""Store interface
Allows arbitrary classes to offer a simple get/set
store interface by deriving from the Store class in
this module
"""
class Store(object):
def __init__(self):
self._data = {}
def set(self, key, value):
self._data[key] = value
def get(self, key, default=None):
return self._data.get(key, default)
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4