Commit 19b5623a authored by Bram Schoenmakers's avatar Bram Schoenmakers

Call super() without parameters now we support Python 3 only

parent 2578521a
......@@ -20,7 +20,7 @@ from topydo.lib.Utils import escape_ansi
class CommandTest(TopydoTest):
def __init__(self, *args, **kwargs):
super(CommandTest, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
self.output = ""
self.errors = ""
......
......@@ -33,7 +33,7 @@ except ImportError:
class AddCommandTest(CommandTest):
def setUp(self):
super(AddCommandTest, self).setUp()
super().setUp()
self.todolist = TodoList.TodoList([])
self.today = date.today().isoformat()
......
......@@ -23,7 +23,7 @@ from topydo.lib.TodoList import TodoList
class AppendCommandTest(CommandTest):
def setUp(self):
super(AppendCommandTest, self).setUp()
super().setUp()
self.todolist = TodoList([])
self.todolist.add("Foo")
......
......@@ -33,7 +33,7 @@ def _no_prompt(self):
class DeleteCommandTest(CommandTest):
def setUp(self):
super(DeleteCommandTest, self).setUp()
super().setUp()
todos = [
"Foo id:1",
"Bar p:1",
......
......@@ -23,7 +23,7 @@ from topydo.lib.TodoList import TodoList
class DepCommandTest(CommandTest):
def setUp(self):
super(DepCommandTest, self).setUp()
super().setUp()
todos = [
"Foo id:1",
"Bar p:1",
......
......@@ -23,7 +23,7 @@ from topydo.lib.TodoList import TodoList
class DepriCommandTest(CommandTest):
def setUp(self):
super(DepriCommandTest, self).setUp()
super().setUp()
todos = [
"(A) Foo",
"Bar",
......
......@@ -32,7 +32,7 @@ def _no_prompt(self):
class DoCommandTest(CommandTest):
def setUp(self):
super(DoCommandTest, self).setUp()
super().setUp()
todos = [
"Foo id:1",
"Bar p:1",
......
......@@ -33,7 +33,7 @@ except ImportError:
class EditCommandTest(CommandTest):
def setUp(self):
super(EditCommandTest, self).setUp()
super().setUp()
todos = [
"Foo id:1",
"Bar p:1 @test",
......
......@@ -301,7 +301,7 @@ class FilterTest(TopydoTest):
class OrdinalTagFilterTest(TopydoTest):
def setUp(self):
super(OrdinalTagFilterTest, self).setUp()
super().setUp()
today = date.today()
tomorrow = today + timedelta(1)
......@@ -381,7 +381,7 @@ class OrdinalTagFilterTest(TopydoTest):
class CreationFilterTest(TopydoTest):
def setUp(self):
super(CreationFilterTest, self).setUp()
super().setUp()
self.todo1 = "2015-12-19 With creation date."
self.todo2 = "Without creation date."
......@@ -415,7 +415,7 @@ class CreationFilterTest(TopydoTest):
class CompletionFilterTest(TopydoTest):
def setUp(self):
super(CompletionFilterTest, self).setUp()
super().setUp()
self.todo1 = "2015-12-19 With creation date."
self.todo2 = "x 2015-12-19 2015-12-18 Without creation date."
......@@ -459,7 +459,7 @@ class CompletionFilterTest(TopydoTest):
class PriorityFilterTest(TopydoTest):
def setUp(self):
super(PriorityFilterTest, self).setUp()
super().setUp()
self.todo1 = "(A) Foo"
self.todo2 = "(B) Bar"
......
......@@ -22,7 +22,7 @@ from topydo.lib.Graph import DirectedGraph
class GraphTest(TopydoTest):
def setUp(self):
super(GraphTest, self).setUp()
super().setUp()
self.graph = DirectedGraph()
......
......@@ -35,7 +35,7 @@ except ImportError:
class ListCommandTest(CommandTest):
def setUp(self):
super(ListCommandTest, self).setUp()
super().setUp()
self.todolist = load_file_to_todolist("test/data/ListCommandTest.txt")
self.terminal_size = namedtuple('terminal_size', ['columns', 'lines'])
......@@ -397,7 +397,7 @@ class ListCommandTest(CommandTest):
class ListCommandUnicodeTest(CommandTest):
def setUp(self):
super(ListCommandUnicodeTest, self).setUp()
super().setUp()
self.todolist = load_file_to_todolist("test/data/ListCommandUnicodeTest.txt")
def test_list_unicode1(self):
......
......@@ -36,7 +36,7 @@ except ImportError:
@freeze_time("2015, 11, 06")
class ListFormatTest(CommandTest):
def setUp(self):
super(ListFormatTest, self).setUp()
super().setUp()
self.todolist = load_file_to_todolist("test/data/ListFormat.txt")
self.terminal_size = namedtuple('terminal_size', ['columns', 'lines'])
......
......@@ -24,7 +24,7 @@ from topydo.lib.TodoList import TodoList
class PostponeCommandTest(CommandTest):
def setUp(self):
super(PostponeCommandTest, self).setUp()
super().setUp()
self.today = date.today()
self.past = date.today() - timedelta(1)
self.future = date.today() + timedelta(1)
......
......@@ -23,7 +23,7 @@ from topydo.lib.TodoList import TodoList
class PriorityCommandTest(CommandTest):
def setUp(self):
super(PriorityCommandTest, self).setUp()
super().setUp()
todos = [
"(A) Foo",
"Bar",
......
......@@ -25,7 +25,7 @@ from topydo.lib.Todo import Todo
class RecurrenceTest(TopydoTest):
def setUp(self):
super(RecurrenceTest, self).setUp()
super().setUp()
self.todo = Todo("Test rec:1w")
self.stricttodo = Todo("Test rec:+1w")
......
......@@ -25,7 +25,7 @@ from topydo.lib.RelativeDate import relative_date_to_date
@freeze_time('2015, 11, 06')
class RelativeDateTester(TopydoTest):
def setUp(self):
super(RelativeDateTester, self).setUp()
super().setUp()
self.yesterday = date(2015, 11, 5)
self.today = date(2015, 11, 6)
self.tomorrow = date(2015, 11, 7)
......
......@@ -35,7 +35,7 @@ from topydo.lib.TodoList import TodoList
class RevertCommandTest(CommandTest):
def setUp(self):
super(RevertCommandTest, self).setUp()
super().setUp()
todos = [
"Foo",
"Bar",
......
......@@ -24,7 +24,7 @@ from topydo.lib.Config import config
class SortCommandTest(CommandTest):
def setUp(self):
super(SortCommandTest, self).setUp()
super().setUp()
self.todolist = load_file_to_todolist("test/data/SorterTest1.txt")
def test_sort1(self):
......
......@@ -24,7 +24,7 @@ from topydo.lib.TodoList import TodoList
class TagCommandTest(CommandTest):
def setUp(self):
super(TagCommandTest, self).setUp()
super().setUp()
todos = [
"Foo",
"Bar due:2014-10-22",
......
......@@ -29,7 +29,7 @@ from topydo.lib.TodoListBase import InvalidTodoException, TodoListBase
class TodoListTester(TopydoTest):
def setUp(self):
super(TodoListTester, self).setUp()
super().setUp()
self.todofile = TodoFile('test/data/TodoListTest.txt')
lines = [line for line in self.todofile.read()
......@@ -230,7 +230,7 @@ class TodoListTester(TopydoTest):
class TodoListDependencyTester(TopydoTest):
def setUp(self):
super(TodoListDependencyTester, self).setUp()
super().setUp()
self.todolist = TodoList([])
self.todolist.add("Foo id:1")
......@@ -383,7 +383,7 @@ class TodoListCleanDependencyTester(TopydoTest):
"""
def setUp(self):
super(TodoListCleanDependencyTester, self).setUp()
super().setUp()
self.todolist = TodoList([])
def test_clean_dependencies1(self):
......
......@@ -41,7 +41,7 @@ class CLIApplication(CLIApplicationBase):
"""
def __init__(self):
super(CLIApplication, self).__init__()
super().__init__()
def run(self):
""" Main entry function. """
......
......@@ -59,7 +59,7 @@ class PromptApplication(CLIApplicationBase):
"""
def __init__(self):
super(PromptApplication, self).__init__()
super().__init__()
self._process_flags()
self.mtime = None
......
......@@ -34,7 +34,7 @@ class AddCommand(Command):
p_out=lambda a: None,
p_err=lambda a: None,
p_prompt=lambda a: None):
super(AddCommand, self).__init__(
super().__init__(
p_args, p_todolist, p_out, p_err, p_prompt)
self.text = ' '.join(p_args)
self.from_file = None
......@@ -119,7 +119,7 @@ class AddCommand(Command):
def execute(self):
""" Adds a todo item to the list. """
if not super(AddCommand, self).execute():
if not super().execute():
return False
self.printer.add_filter(PrettyPrinterNumbers(self.todolist))
......
......@@ -24,11 +24,11 @@ class AppendCommand(Command):
p_out=lambda a: None,
p_err=lambda a: None,
p_prompt=lambda a: None):
super(AppendCommand, self).__init__(p_args, p_todolist, p_out, p_err,
super().__init__(p_args, p_todolist, p_out, p_err,
p_prompt)
def execute(self):
if not super(AppendCommand, self).execute():
if not super().execute():
return False
try:
......
......@@ -27,7 +27,7 @@ class ArchiveCommand(Command):
TodoListBase class which does no dependency checking, so a better
choice for huge done.txt files.
"""
super(ArchiveCommand, self).__init__([], p_todolist)
super().__init__([], p_todolist)
self.archive = p_archive_list
def execute(self):
......
......@@ -22,7 +22,7 @@ class DeleteCommand(DCommand):
p_out=lambda a: None,
p_err=lambda a: None,
p_prompt=lambda a: None):
super(DeleteCommand, self).__init__(
super().__init__(
p_args, p_todolist, p_out, p_err, p_prompt)
def prompt_text(self):
......
......@@ -28,7 +28,7 @@ class DepCommand(Command):
p_out=lambda a: None,
p_err=lambda a: None,
p_prompt=lambda a: None):
super(DepCommand, self).__init__(
super().__init__(
p_args, p_todolist, p_out, p_err, p_prompt)
try:
......@@ -109,7 +109,7 @@ class DepCommand(Command):
self.error(self.usage())
def execute(self):
if not super(DepCommand, self).execute():
if not super().execute():
return False
dispatch = {
......
......@@ -23,7 +23,7 @@ class DepriCommand(MultiCommand):
p_out=lambda a: None,
p_err=lambda a: None,
p_prompt=lambda a: None):
super(DepriCommand, self).__init__(
super().__init__(
p_args, p_todolist, p_out, p_err, p_prompt)
def _execute_multi_specific(self):
......
......@@ -33,17 +33,17 @@ class DoCommand(DCommand):
self.strict_recurrence = False
self.completion_date = date.today()
super(DoCommand, self).__init__(
super().__init__(
p_args, p_todolist, p_out, p_err, p_prompt)
def get_flags(self):
""" Additional flags. """
opts, long_opts = super(DoCommand, self).get_flags()
opts, long_opts = super().get_flags()
return ("d:s" + opts, ["date=", "strict"] + long_opts)
def process_flag(self, p_opt, p_value):
super(DoCommand, self).process_flag(p_opt, p_value)
super().process_flag(p_opt, p_value)
if p_opt == "-s" or p_opt == "--strict":
self.strict_recurrence = True
......
......@@ -39,7 +39,7 @@ def _is_edited(p_orig_mtime, p_file):
class EditCommand(MultiCommand):
def __init__(self, p_args, p_todolist, p_output, p_error, p_input):
super(EditCommand, self).__init__(p_args, p_todolist, p_output,
super().__init__(p_args, p_todolist, p_output,
p_error, p_input)
if len(self.args) == 0:
......
......@@ -26,11 +26,11 @@ class ExitCommand(Command):
"""
def __init__(self, p_args, p_todolist, p_output, p_error, p_input):
super(ExitCommand, self).__init__(p_args, p_todolist, p_output, p_error,
super().__init__(p_args, p_todolist, p_output, p_error,
p_input)
def execute(self):
if not super(ExitCommand, self).execute():
if not super().execute():
return False
sys.exit(0)
......@@ -28,7 +28,7 @@ class ListCommand(ExpressionCommand):
p_out=lambda a: None,
p_err=lambda a: None,
p_prompt=lambda a: None):
super(ListCommand, self).__init__(
super().__init__(
p_args, p_todolist, p_out, p_err, p_prompt)
self.printer = None
......@@ -92,7 +92,7 @@ class ListCommand(ExpressionCommand):
Additional filters to select particular todo items given with the -i
flag.
"""
filters = super(ListCommand, self)._filters()
filters = super()._filters()
if self.ids:
def get_todo(p_id):
......@@ -132,7 +132,7 @@ class ListCommand(ExpressionCommand):
self.out(self.printer.print_list(self._view().todos))
def execute(self):
if not super(ListCommand, self).execute():
if not super().execute():
return False
try:
......
......@@ -22,11 +22,11 @@ class ListContextCommand(Command):
p_out=lambda a: None,
p_err=lambda a: None,
p_prompt=lambda a: None):
super(ListContextCommand, self).__init__(
super().__init__(
p_args, p_todolist, p_out, p_err, p_prompt)
def execute(self):
if not super(ListContextCommand, self).execute():
if not super().execute():
return False
for context in sorted(self.todolist.contexts(), key=lambda s: s.lower()):
......
......@@ -22,11 +22,11 @@ class ListProjectCommand(Command):
p_out=lambda a: None,
p_err=lambda a: None,
p_prompt=lambda a: None):
super(ListProjectCommand, self).__init__(
super().__init__(
p_args, p_todolist, p_out, p_err, p_prompt)
def execute(self):
if not super(ListProjectCommand, self).execute():
if not super().execute():
return False
for project in sorted(self.todolist.projects(), key=lambda s: s.lower()):
......
......@@ -28,7 +28,7 @@ class PostponeCommand(MultiCommand):
p_out=lambda a: None,
p_err=lambda a: None,
p_prompt=lambda a: None):
super(PostponeCommand, self).__init__(
super().__init__(
p_args, p_todolist, p_out, p_err, p_prompt)
self.move_start_date = False
......
......@@ -26,7 +26,7 @@ class PriorityCommand(MultiCommand):
p_out=lambda a: None,
p_err=lambda a: None,
p_prompt=lambda a: None):
super(PriorityCommand, self).__init__(
super().__init__(
p_args, p_todolist, p_out, p_err, p_prompt)
self.last_argument = True
......
......@@ -25,11 +25,11 @@ class RevertCommand(Command):
p_out=lambda a: None,
p_err=lambda a: None,
p_prompt=lambda a: None):
super(RevertCommand, self).__init__(p_args, p_todolist, p_out, p_err,
super().__init__(p_args, p_todolist, p_out, p_err,
p_prompt)
def execute(self):
if not super(RevertCommand, self).execute():
if not super().execute():
return False
archive_file = TodoFile.TodoFile(config().archive())
......
......@@ -24,11 +24,11 @@ class SortCommand(Command):
p_out=lambda a: None,
p_err=lambda a: None,
p_prompt=lambda a: None):
super(SortCommand, self).__init__(
super().__init__(
p_args, p_todolist, p_out, p_err, p_prompt)
def execute(self):
if not super(SortCommand, self).execute():
if not super().execute():
return False
try:
......
......@@ -26,7 +26,7 @@ class TagCommand(Command):
p_out=lambda a: None,
p_err=lambda a: None,
p_prompt=lambda a: None):
super(TagCommand, self).__init__(
super().__init__(
p_args, p_todolist, p_out, p_err, p_prompt)
self.force = False
......@@ -124,7 +124,7 @@ class TagCommand(Command):
self._print()
def execute(self):
if not super(TagCommand, self).execute():
if not super().execute():
return False
self._process_args()
......
......@@ -31,7 +31,7 @@ class DCommand(MultiCommand):
p_out=lambda a: None,
p_err=lambda a: None,
p_prompt=lambda a: None):
super(DCommand, self).__init__(
super().__init__(
p_args, p_todolist, p_out, p_err, p_prompt)
self.force = False
......
......@@ -32,7 +32,7 @@ class ExpressionCommand(Command):
p_out=lambda a: None,
p_err=lambda a: None,
p_prompt=lambda a: None):
super(ExpressionCommand, self).__init__(
super().__init__(
p_args, p_todolist, p_out, p_err, p_prompt)
self.sort_expression = config().sort_string()
......
......@@ -62,7 +62,7 @@ class GrepFilter(Filter):
""" Matches when the todo text contains a text. """
def __init__(self, p_expression, p_case_sensitive=None):
super(GrepFilter, self).__init__()
super().__init__()
# convert to string in case we receive integers
self.expression = p_expression
......@@ -115,7 +115,7 @@ class DependencyFilter(Filter):
Pass on a TodoList instance such that the dependencies can be
looked up.
"""
super(DependencyFilter, self).__init__()
super().__init__()
self.todolist = p_todolist
def match(self, p_todo):
......@@ -138,7 +138,7 @@ class InstanceFilter(Filter):
This is handy for constructing a view given a plain list of Todo items.
"""
super(InstanceFilter, self).__init__()
super().__init__()
self.todos = p_todos
def match(self, p_todo):
......@@ -154,7 +154,7 @@ class InstanceFilter(Filter):
class LimitFilter(Filter):
def __init__(self, p_limit):
super(LimitFilter, self).__init__()
super().__init__()
self.limit = p_limit
def filter(self, p_todos):
......@@ -167,7 +167,7 @@ class OrdinalFilter(Filter):
""" Base class for ordinal filters. """
def __init__(self, p_expression, p_pattern):
super(OrdinalFilter, self).__init__()
super().__init__()
self.expression = p_expression
......@@ -206,7 +206,7 @@ _ORDINAL_TAG_MATCH = r"(?P<key>[^:]*):" + _OPERATOR_MATCH + _VALUE_MATCH
class OrdinalTagFilter(OrdinalFilter):
def __init__(self, p_expression):
super(OrdinalTagFilter, self).__init__(p_expression, _ORDINAL_TAG_MATCH)
super().__init__(p_expression, _ORDINAL_TAG_MATCH)
def match(self, p_todo):
"""
......@@ -247,7 +247,7 @@ class OrdinalTagFilter(OrdinalFilter):
class _DateAttributeFilter(OrdinalFilter):
def __init__(self, p_expression, p_match, p_getter):
super(_DateAttributeFilter, self).__init__(p_expression, p_match)
super().__init__(p_expression, p_match)
self.getter = p_getter
def match(self, p_todo):
......@@ -268,7 +268,7 @@ _CREATED_MATCH = r'creat(ion|ed?):' + _OPERATOR_MATCH + _VALUE_MATCH
class CreationFilter(_DateAttributeFilter):
def __init__(self, p_expression):
super(CreationFilter, self).__init__(
super().__init__(
p_expression,
_CREATED_MATCH,
lambda t: t.creation_date() # pragma: no branch
......@@ -280,7 +280,7 @@ _COMPLETED_MATCH = r'complet(ed?|ion):' + _OPERATOR_MATCH + _VALUE_MATCH
class CompletionFilter(_DateAttributeFilter):
def __init__(self, p_expression):
super(CompletionFilter, self).__init__(
super().__init__(
p_expression,
_COMPLETED_MATCH,
lambda t: t.completion_date() # pragma: no branch
......@@ -292,7 +292,7 @@ _PRIORITY_MATCH = r"\(" + _OPERATOR_MATCH + r"(?P<value>[A-Z]{1})\)"
class PriorityFilter(OrdinalFilter):
def __init__(self, p_expression):
super(PriorityFilter, self).__init__(p_expression, _PRIORITY_MATCH)
super().__init__(p_expression, _PRIORITY_MATCH)
def match(self, p_todo):
"""
......
......@@ -66,7 +66,7 @@ class IcalPrinter(Printer):
"""
def __init__(self, p_todolist):
super(IcalPrinter, self).__init__()
super().__init__()
self.todolist = p_todolist
try:
......
......@@ -52,7 +52,7 @@ class JsonPrinter(Printer):
"""
def __init__(self):
super(JsonPrinter, self).__init__()
super().__init__()
def print_todo(self, p_todo):
return json.dumps(_convert_todo(p_todo), ensure_ascii=False,
......
......@@ -27,7 +27,7 @@ class MultiCommand(ExpressionCommand):
p_out=lambda a: None,
p_err=lambda a: None,
p_prompt=lambda a: None):
super(MultiCommand, self).__init__(
super().__init__(
p_args, p_todolist, p_out, p_err, p_prompt)
self.todos = []
......@@ -114,7 +114,7 @@ class MultiCommand(ExpressionCommand):
raise NotImplementedError
def execute(self):
if not super(MultiCommand, self).execute():
if not super().execute():
return False
self._process_flags()
......
......@@ -50,7 +50,7 @@ class PrettyPrinter(Printer):
"""
Constructor.
"""
super(PrettyPrinter, self).__init__()
super().__init__()
self.filters = []
def add_filter(self, p_filter):
......
......@@ -41,7 +41,7 @@ class TodoList(TodoListBase):
self._tododict = {} # hash(todo) to todo lookup
self._depgraph = DirectedGraph()
super(TodoList, self).__init__(p_todostrings)
super().__init__(p_todostrings)
def todo_by_dep_id(self, p_dep_id):
"""
......
......@@ -25,7 +25,7 @@ from topydo.lib.ListFormat import ListFormatParser
class PrettyPrinterFormatFilter(PrettyPrinterFilter):
def __init__(self, p_todolist, p_format=None):
super(PrettyPrinterFormatFilter, self).__init__()
super().__init__()
self.parser = ListFormatParser(p_todolist, p_format)
def filter(self, p_todo_str, p_todo):
......
......@@ -23,7 +23,7 @@ class PrettyPrinterNumbers(PrettyPrinterFilter):
""" Prepends the todo's number, retrieved from the todolist. """
def __init__(self, p_todolist):
super(PrettyPrinterNumbers, self).__init__()
super().__init__()
self.todolist = p_todolist
def filter(self, p_todo_str, p_todo):
......
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