Commit d5c1b4ec authored by Bram Schoenmakers's avatar Bram Schoenmakers

Let abstract implementations raise NotImplementedError.

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