fd4e42f0fe
Expand and reorg the naming discussion. Add a section on the mechanics of creating plugins, with some tested example code. Signed-off-by: Doug Hellmann <doug.hellmann@dreamhost.com>
22 lines
522 B
Python
22 lines
522 B
Python
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.
|
|
"""
|