summaryrefslogtreecommitdiff
path: root/stevedore/example/base.py
blob: d128a5367e85917a70e5d0e7c59a22fcc5357b00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import abc


class FormatterBase(object):
    """Base class for example plugin used in the tutoral.
    """

    __metaclass__ = abc.ABCMeta

    def __init__(self, max_width=60):
        self.max_width = max_width

    @abc.abstractmethod
    def format(self, data):
        """Format the data and return unicode text.

        :param data: A dictionary with string keys and simple types as
                     values.
        :type data: dict(str:?)
        :returns: Iterable producing the formatted text.
        """