From a0318ce82eca77d84420bf00e85ec67cfda8a71b Mon Sep 17 00:00:00 2001 From: Joar Wandborg Date: Tue, 17 Dec 2013 11:14:45 +0100 Subject: [PATCH] [storage] Proper ABC --- accounting/storage/__init__.py | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/accounting/storage/__init__.py b/accounting/storage/__init__.py index 1403245..bbaa16d 100644 --- a/accounting/storage/__init__.py +++ b/accounting/storage/__init__.py @@ -1,19 +1,35 @@ +from abc import ABCMeta, abstractmethod -class Storage: + +class Storage(): ''' ABC for accounting storage ''' + __metaclass__ = ABCMeta + def __init__(self, *args, **kw): - raise NotImplementedError() + pass + @abstractmethod def get_transactions(self, *args, **kw): - raise NotImplementedError() + raise NotImplementedError + @abstractmethod def get_transaction(self, *args, **kw): - raise NotImplementedError() + raise NotImplementedError + @abstractmethod def get_account(self, *args, **kw): - raise NotImplementedError() + raise NotImplementedError + @abstractmethod def get_accounts(self, *args, **kw): - raise NotImplementedError() + raise NotImplementedError + + @abstractmethod + def update_transaction(self, transaction): + raise NotImplementedError + + @abstractmethod + def reverse_transaction(self, transaction_id): + raise NotImplementedError