Commit bdee1ff2 by Michael DeHaan

Standardize exception handling

parent a620ef41
import exceptions
class BaseCacheModule(object): class BaseCacheModule(object):
def get(self, key): def get(self, key):
raise NotImplementedError("Subclasses of {} must implement the '{}' method".format(self.__class__.__name__, self.__name__)) raise exceptions.NotImplementedError
def set(self, key, value): def set(self, key, value):
raise NotImplementedError("Subclasses of {} must implement the '{}' method".format(self.__class__.__name__, self.__name__)) raise exceptions.NotImplementedError
def keys(self): def keys(self):
raise NotImplementedError("Subclasses of {} must implement the '{}' method".format(self.__class__.__name__, self.__name__)) raise exceptions.NotImplementedError
def contains(self, key): def contains(self, key):
raise NotImplementedError("Subclasses of {} must implement the '{}' method".format(self.__class__.__name__, self.__name__)) raise exceptions.NotImplementedError
def delete(self, key): def delete(self, key):
raise NotImplementedError("Subclasses of {} must implement the '{}' method".format(self.__class__.__name__, self.__name__)) raise exceptions.NotImplementedError
def flush(self): def flush(self):
raise NotImplementedError("Subclasses of {} must implement the '{}' method".format(self.__class__.__name__, self.__name__)) raise exceptions.NotImplementedError
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment