summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alot/account.py6
-rw-r--r--alot/addressbook/__init__.py5
-rw-r--r--alot/completion.py7
3 files changed, 16 insertions, 2 deletions
diff --git a/alot/account.py b/alot/account.py
index 912380e3..5e66e9bf 100644
--- a/alot/account.py
+++ b/alot/account.py
@@ -1,6 +1,7 @@
# Copyright (C) 2011-2012 Patrick Totzke <patricktotzke@gmail.com>
# This file is released under the GNU GPL, version 3 or a later revision.
# For further details see the COPYING file
+import abc
import glob
import logging
import mailbox
@@ -29,6 +30,8 @@ class Account(object):
command to send out mails.
"""
+ __metaclass__ = abc.ABCMeta
+
address = None
"""this accounts main email address"""
aliases = []
@@ -159,6 +162,7 @@ class Account(object):
if self.draft_box is not None:
return self.store_mail(self.draft_box, mail)
+ @abc.abstractmethod
def send_mail(self, mail):
"""
sends given mail
@@ -168,7 +172,7 @@ class Account(object):
:returns: a `Deferred` that errs back with a class:`SendingMailFailed`,
containing a reason string if an error occured.
"""
- raise NotImplementedError
+ pass
class SendmailAccount(Account):
diff --git a/alot/addressbook/__init__.py b/alot/addressbook/__init__.py
index 6269f5d1..da0863f4 100644
--- a/alot/addressbook/__init__.py
+++ b/alot/addressbook/__init__.py
@@ -2,6 +2,7 @@
# This file is released under the GNU GPL, version 3 or a later revision.
# For further details see the COPYING file
import re
+import abc
class AddressbookError(Exception):
@@ -17,9 +18,13 @@ class AddressBook(object):
unspecified. See :class:`AbookAddressBook` and
:class:`ExternalAddressbook` for implementations.
"""
+
+ __metaclass__ = abc.ABCMeta
+
def __init__(self, ignorecase=True):
self.reflags = re.IGNORECASE if ignorecase else 0
+ @abc.abstractmethod
def get_contacts(self):
"""list all contacts tuples in this abook as (name, email) tuples"""
return []
diff --git a/alot/completion.py b/alot/completion.py
index 314fa0c6..cb9bbad8 100644
--- a/alot/completion.py
+++ b/alot/completion.py
@@ -1,6 +1,7 @@
# Copyright (C) 2011-2012 Patrick Totzke <patricktotzke@gmail.com>
# This file is released under the GNU GPL, version 3 or a later revision.
# For further details see the COPYING file
+import abc
import argparse
import glob
import logging
@@ -19,6 +20,10 @@ from .errors import CompletionError
class Completer(object):
"""base class for completers"""
+
+ __metaclass__ = abc.ABCMeta
+
+ @abc.abstractmethod
def complete(self, original, pos):
"""returns a list of completions and cursor positions for the
string original from position pos on.
@@ -32,7 +37,7 @@ class Completer(object):
:rtype: list of (str, int)
:raises: :exc:`CompletionError`
"""
- return list()
+ pass
def relevant_part(self, original, pos, sep=' '):
"""