From: Tomas Babej Date: Sat, 8 Aug 2015 21:55:47 +0000 (+0200) Subject: filters: Define TaskFilter base class X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/commitdiff_plain/f986b814683ddee836b534f344bca017ac697c58 filters: Define TaskFilter base class --- diff --git a/tasklib/filters.py b/tasklib/filters.py index 211302f..7b44e98 100644 --- a/tasklib/filters.py +++ b/tasklib/filters.py @@ -1,7 +1,35 @@ +import abc from tasklib.serializing import SerializingObject -class TaskWarriorFilter(SerializingObject): +class TaskFilter(object): + """ + Abstract base class that defines interface of a TaskFilter. + """ + + @abc.abstractmethod + def add_filter(self, arg): + """ + Processes an non-keyword filter. + """ + pass + + @abc.abstractmethod + def add_filter_param(self, key, value): + """ + Processes a keyword filter. + """ + pass + + @abc.abstractmethod + def clone(self): + """ + Returns a new deep copy of itself. + """ + pass + + +class TaskWarriorFilter(TaskFilter, SerializingObject): """ A set of parameters to filter the task list with. """