From f986b814683ddee836b534f344bca017ac697c58 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Sat, 8 Aug 2015 23:55:47 +0200 Subject: [PATCH] filters: Define TaskFilter base class --- tasklib/filters.py | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) 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. """ -- 2.39.5