bumblebee-status/bumblebee/store.py
Tobias Witek 2e26f6d0c4 [core] Log parameter that were not used after each draw
Whenever a new bar is being drawn, log out all parameters that were not
used at all. This might indicate a bug in the module, or might point to
a spelling error in the parameter name.

fixes #494
2019-12-25 13:40:02 +01:00

27 lines
788 B
Python

"""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):
"""Interface for storing and retrieving simple values"""
def __init__(self):
self._data = {}
self._unused = {}
def set(self, key, value):
"""Set 'key' to 'value', overwriting 'key' if it exists already"""
self._data[key] = value
self._unused[key] = value
def unused_keys(self):
return self._unused.keys()
def get(self, key, default=None):
"""Return the current value of 'key', or 'default' if 'key' is not set"""
self._unused.pop(key, None)
return self._data.get(key, default)
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4