Commit d5c1b4ec authored by Bram Schoenmakers's avatar Bram Schoenmakers

Let abstract implementations raise NotImplementedError.

parent 58c33a93
......@@ -44,8 +44,7 @@ class DCommand(MultiCommand):
return ("", [])
def process_flag(self, p_option, p_value):
""" Default implementation of processing specific flags. """
pass
raise NotImplementedError
def process_flags(self):
opts, args = self.get_flags()
......@@ -71,11 +70,10 @@ class DCommand(MultiCommand):
self.out(printer.print_list(p_todos))
def prompt_text(self):
return "Yes or no? [y/N] "
raise NotImplementedError
def prefix(self):
""" Prefix to use when printing a todo. """
return ""
raise NotImplementedError
def _process_subtasks(self, p_todo):
children = self._uncompleted_children(p_todo)
......@@ -116,17 +114,17 @@ class DCommand(MultiCommand):
return True
def condition_failed_text(self):
return ""
raise NotImplementedError
def execute_specific(self, _):
pass
raise NotImplementedError
def execute_specific_core(self, p_todo):
"""
The core operation on the todo itself. Also used to operate on
child/parent tasks.
"""
pass
raise NotImplementedError
def execute_multi_specific(self):
old_active = self._active_todos()
......
......@@ -46,7 +46,7 @@ class ListCommand(ExpressionCommand):
"""
try:
import icalendar as _
except ImportError:
except ImportError: # pragma: no cover
self.error("icalendar package is not installed.")
return False
......@@ -101,7 +101,7 @@ class ListCommand(ExpressionCommand):
try:
self._process_flags()
except SyntaxError:
except SyntaxError: # pragma: no cover
# importing icalendar failed, most likely due to Python 3.2
self.error("icalendar is not supported in this Python version.")
return False
......
......@@ -84,8 +84,10 @@ class Command(object):
return result
def usage(self):
return "No usage text available for this command."
""" Returns a one-line synopsis for this command. """
raise NotImplementedError
def help(self):
return "No help text available for this command."
""" Returns the help text for this command. """
raise NotImplementedError
......@@ -29,8 +29,7 @@ class Filter(object):
return [t for t in p_todos if self.match(t)]
def match(self, _):
""" Default match value. """
return True
raise NotImplementedError
class NegationFilter(Filter):
def __init__(self, p_filter):
......
......@@ -26,8 +26,7 @@ class Printer(object):
Subclasses must at least implement the print_todo method.
"""
def print_todo(self, p_todo):
""" Base implementation."""
return p_todo.source()
raise NotImplementedError
def print_list(self, p_todos):
"""
......
......@@ -30,8 +30,10 @@ class PrettyPrinterFilter(object):
"""
def filter(self, p_todo_str, _):
""" Default implementation returns an unmodified todo string. """
return p_todo_str
"""
Applies a filter to p_todo_str and returns a modified version of it.
"""
raise NotImplementedError
class PrettyPrinterColorFilter(PrettyPrinterFilter):
"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment