Commit ab290dad authored by MinchinWeb's avatar MinchinWeb

Fix PEP8 E502

the backslash is redundant between brackets
parent c6b5ff49
...@@ -41,7 +41,7 @@ class FilterTest(TopydoTest): ...@@ -41,7 +41,7 @@ class FilterTest(TopydoTest):
filtered_todos = grep.filter(todos) filtered_todos = grep.filter(todos)
reference = load_file('test/data/FilterTest1a-result.txt') reference = load_file('test/data/FilterTest1a-result.txt')
self.assertEqual(todolist_to_string(filtered_todos), \ self.assertEqual(todolist_to_string(filtered_todos),
todolist_to_string(reference)) todolist_to_string(reference))
def test_filter05(self): def test_filter05(self):
...@@ -52,7 +52,7 @@ class FilterTest(TopydoTest): ...@@ -52,7 +52,7 @@ class FilterTest(TopydoTest):
filtered_todos = grep.filter(todos) filtered_todos = grep.filter(todos)
reference = load_file('test/data/FilterTest1b-result.txt') reference = load_file('test/data/FilterTest1b-result.txt')
self.assertEqual(todolist_to_string(filtered_todos), \ self.assertEqual(todolist_to_string(filtered_todos),
todolist_to_string(reference)) todolist_to_string(reference))
def test_filter06(self): def test_filter06(self):
...@@ -63,7 +63,7 @@ class FilterTest(TopydoTest): ...@@ -63,7 +63,7 @@ class FilterTest(TopydoTest):
filtered_todos = grep.filter(todos) filtered_todos = grep.filter(todos)
reference = load_file('test/data/FilterTest1c-result.txt') reference = load_file('test/data/FilterTest1c-result.txt')
self.assertEqual(todolist_to_string(filtered_todos), \ self.assertEqual(todolist_to_string(filtered_todos),
todolist_to_string(reference)) todolist_to_string(reference))
def test_filter07(self): def test_filter07(self):
...@@ -74,7 +74,7 @@ class FilterTest(TopydoTest): ...@@ -74,7 +74,7 @@ class FilterTest(TopydoTest):
filtered_todos = depfilter.filter(todolist.todos()) filtered_todos = depfilter.filter(todolist.todos())
reference = load_file('test/data/FilterTest2-result.txt') reference = load_file('test/data/FilterTest2-result.txt')
self.assertEqual(todolist_to_string(filtered_todos), \ self.assertEqual(todolist_to_string(filtered_todos),
todolist_to_string(reference)) todolist_to_string(reference))
def test_filter08(self): def test_filter08(self):
...@@ -85,7 +85,7 @@ class FilterTest(TopydoTest): ...@@ -85,7 +85,7 @@ class FilterTest(TopydoTest):
filtered_todos = grep.filter(todos) filtered_todos = grep.filter(todos)
reference = load_file('test/data/FilterTest1a-result.txt') reference = load_file('test/data/FilterTest1a-result.txt')
self.assertEqual(todolist_to_string(filtered_todos), \ self.assertEqual(todolist_to_string(filtered_todos),
todolist_to_string(reference)) todolist_to_string(reference))
def test_filter09(self): def test_filter09(self):
...@@ -160,7 +160,7 @@ class FilterTest(TopydoTest): ...@@ -160,7 +160,7 @@ class FilterTest(TopydoTest):
filtered_todos = grep.filter(todos) filtered_todos = grep.filter(todos)
reference = load_file('test/data/FilterTest3-result.txt') reference = load_file('test/data/FilterTest3-result.txt')
self.assertEqual(todolist_to_string(filtered_todos), \ self.assertEqual(todolist_to_string(filtered_todos),
todolist_to_string(reference)) todolist_to_string(reference))
def test_filter17(self): def test_filter17(self):
...@@ -172,7 +172,7 @@ class FilterTest(TopydoTest): ...@@ -172,7 +172,7 @@ class FilterTest(TopydoTest):
filtered_todos = andfilter.filter(todos) filtered_todos = andfilter.filter(todos)
reference = load_file('test/data/FilterTest4-result.txt') reference = load_file('test/data/FilterTest4-result.txt')
self.assertEqual(todolist_to_string(filtered_todos), \ self.assertEqual(todolist_to_string(filtered_todos),
todolist_to_string(reference)) todolist_to_string(reference))
def test_filter18(self): def test_filter18(self):
...@@ -184,7 +184,7 @@ class FilterTest(TopydoTest): ...@@ -184,7 +184,7 @@ class FilterTest(TopydoTest):
filtered_todos = grep.filter(todos) filtered_todos = grep.filter(todos)
reference = load_file('test/data/FilterTest5-result.txt') reference = load_file('test/data/FilterTest5-result.txt')
self.assertEqual(todolist_to_string(filtered_todos), \ self.assertEqual(todolist_to_string(filtered_todos),
todolist_to_string(reference)) todolist_to_string(reference))
def test_filter20(self): def test_filter20(self):
...@@ -194,7 +194,7 @@ class FilterTest(TopydoTest): ...@@ -194,7 +194,7 @@ class FilterTest(TopydoTest):
filtered_todos = otf.filter(todos) filtered_todos = otf.filter(todos)
reference = load_file('test/data/FilterTest6-result.txt') reference = load_file('test/data/FilterTest6-result.txt')
self.assertEqual(todolist_to_string(filtered_todos), \ self.assertEqual(todolist_to_string(filtered_todos),
todolist_to_string(reference)) todolist_to_string(reference))
def test_filter21(self): def test_filter21(self):
......
...@@ -261,7 +261,7 @@ class TodoBaseTester(TopydoTest): ...@@ -261,7 +261,7 @@ class TodoBaseTester(TopydoTest):
today_str = today.isoformat() today_str = today.isoformat()
self.assertEqual(todo.fields['completionDate'], today) self.assertEqual(todo.fields['completionDate'], today)
self.assertTrue(re.match('^x ' + today_str + ' 2014-06-12 Foo', \ self.assertTrue(re.match('^x ' + today_str + ' 2014-06-12 Foo',
todo.src)) todo.src))
def test_set_complete3(self): def test_set_complete3(self):
......
...@@ -31,7 +31,7 @@ class TodoFileTest(TopydoTest): ...@@ -31,7 +31,7 @@ class TodoFileTest(TopydoTest):
todofile = load_file('test/data/utf-8.txt') todofile = load_file('test/data/utf-8.txt')
self.assertEqual(todofile[0].source(), self.assertEqual(todofile[0].source(),
u('(C) \u25ba UTF-8 test \u25c4')) u('(C) \u25ba UTF-8 test \u25c4'))
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
...@@ -33,18 +33,18 @@ class TodoListTester(TopydoTest): ...@@ -33,18 +33,18 @@ class TodoListTester(TopydoTest):
super(TodoListTester, self).setUp() super(TodoListTester, self).setUp()
self.todofile = TodoFile('test/data/TodoListTest.txt') self.todofile = TodoFile('test/data/TodoListTest.txt')
lines = [line for line in self.todofile.read() \ lines = [line for line in self.todofile.read()
if re.search(r'\S', line)] if re.search(r'\S', line)]
self.text = ''.join(lines) self.text = ''.join(lines)
self.todolist = TodoListBase(lines) self.todolist = TodoListBase(lines)
def test_contexts(self): def test_contexts(self):
self.assertEqual(set(['Context1', 'Context2']), \ self.assertEqual(set(['Context1', 'Context2']),
self.todolist.contexts()) self.todolist.contexts())
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.is_dirty())
def test_projects(self): def test_projects(self):
self.assertEqual(set(['Project1', 'Project2']), \ self.assertEqual(set(['Project1', 'Project2']),
self.todolist.projects()) self.todolist.projects())
self.assertFalse(self.todolist.is_dirty()) self.assertFalse(self.todolist.is_dirty())
...@@ -54,9 +54,9 @@ class TodoListTester(TopydoTest): ...@@ -54,9 +54,9 @@ class TodoListTester(TopydoTest):
todo = self.todolist.add(text) todo = self.todolist.add(text)
self.assertEqual(self.todolist.todo(count+1).source(), text) self.assertEqual(self.todolist.todo(count+1).source(), text)
self.assertEqual(set(['Project1', 'Project2', 'Project3']), \ self.assertEqual(set(['Project1', 'Project2', 'Project3']),
self.todolist.projects()) self.todolist.projects())
self.assertEqual(set(['Context1', 'Context2', 'Context3']), \ self.assertEqual(set(['Context1', 'Context2', 'Context3']),
self.todolist.contexts()) self.todolist.contexts())
self.assertEqual(self.todolist.number(todo), 6) self.assertEqual(self.todolist.number(todo), 6)
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.is_dirty())
...@@ -99,7 +99,7 @@ class TodoListTester(TopydoTest): ...@@ -99,7 +99,7 @@ class TodoListTester(TopydoTest):
todo = self.todolist.todo(2) todo = self.todolist.todo(2)
self.todolist.delete(todo) self.todolist.delete(todo)
self.assertEqual(self.todolist.todo(2).source(), \ self.assertEqual(self.todolist.todo(2).source(),
"(C) Baz @Context1 +Project1 key:value") "(C) Baz @Context1 +Project1 key:value")
self.assertEqual(self.todolist.count(), count - 1) self.assertEqual(self.todolist.count(), count - 1)
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.is_dirty())
...@@ -119,9 +119,9 @@ class TodoListTester(TopydoTest): ...@@ -119,9 +119,9 @@ class TodoListTester(TopydoTest):
todo = self.todolist.todo(3) todo = self.todolist.todo(3)
self.todolist.append(todo, "@Context3") self.todolist.append(todo, "@Context3")
self.assertEqual(todo.source(), \ self.assertEqual(todo.source(),
"(C) Baz @Context1 +Project1 key:value @Context3") "(C) Baz @Context1 +Project1 key:value @Context3")
self.assertEqual(set(['Context1', 'Context2', 'Context3']), \ self.assertEqual(set(['Context1', 'Context2', 'Context3']),
self.todolist.contexts()) self.todolist.contexts())
self.assertTrue(self.todolist.is_dirty()) self.assertTrue(self.todolist.is_dirty())
...@@ -131,7 +131,7 @@ class TodoListTester(TopydoTest): ...@@ -131,7 +131,7 @@ class TodoListTester(TopydoTest):
self.todolist.append(todo, "foo:bar") self.todolist.append(todo, "foo:bar")
self.assertEqual(todo.text(), text) self.assertEqual(todo.text(), text)
self.assertEqual(todo.source(), \ self.assertEqual(todo.source(),
"(C) Baz @Context1 +Project1 key:value foo:bar") "(C) Baz @Context1 +Project1 key:value foo:bar")
def test_append3(self): def test_append3(self):
...@@ -248,23 +248,23 @@ class TodoListDependencyTester(TopydoTest): ...@@ -248,23 +248,23 @@ class TodoListDependencyTester(TopydoTest):
def test_check_dep(self): def test_check_dep(self):
children = self.todolist.children(self.todolist.todo(1)) children = self.todolist.children(self.todolist.todo(1))
self.assertEqual(sorted([todo.source() for todo in children]), \ self.assertEqual(sorted([todo.source() for todo in children]),
sorted(['Bar p:1', 'Baz p:1 id:2', 'Buzz p:2'])) sorted(['Bar p:1', 'Baz p:1 id:2', 'Buzz p:2']))
children = self.todolist.children(self.todolist.todo(1), True) children = self.todolist.children(self.todolist.todo(1), True)
self.assertEqual(sorted([todo.source() for todo in children]), \ self.assertEqual(sorted([todo.source() for todo in children]),
sorted(['Bar p:1', 'Baz p:1 id:2'])) sorted(['Bar p:1', 'Baz p:1 id:2']))
children = self.todolist.children(self.todolist.todo(3)) children = self.todolist.children(self.todolist.todo(3))
self.assertEqual(sorted([todo.source() for todo in children]), \ self.assertEqual(sorted([todo.source() for todo in children]),
['Buzz p:2']) ['Buzz p:2'])
parents = self.todolist.parents(self.todolist.todo(4)) parents = self.todolist.parents(self.todolist.todo(4))
self.assertEqual(sorted([todo.source() for todo in parents]), \ self.assertEqual(sorted([todo.source() for todo in parents]),
sorted(['Foo id:1', 'Baz p:1 id:2'])) sorted(['Foo id:1', 'Baz p:1 id:2']))
parents = self.todolist.parents(self.todolist.todo(4), True) parents = self.todolist.parents(self.todolist.todo(4), True)
self.assertEqual(sorted([todo.source() for todo in parents]), \ self.assertEqual(sorted([todo.source() for todo in parents]),
['Baz p:1 id:2']) ['Baz p:1 id:2'])
self.assertEqual(self.todolist.children(self.todolist.todo(2)), []) self.assertEqual(self.todolist.children(self.todolist.todo(2)), [])
......
...@@ -93,7 +93,7 @@ class DirectedGraph(object): ...@@ -93,7 +93,7 @@ class DirectedGraph(object):
visited.add(current) visited.add(current)
if p_reverse: if p_reverse:
parents = [node for node, neighbors in self._edges.items() \ parents = [node for node, neighbors in self._edges.items()
if current in neighbors] if current in neighbors]
stack = stack + parents stack = stack + parents
......
...@@ -41,10 +41,10 @@ def get_field_function(p_field): ...@@ -41,10 +41,10 @@ def get_field_function(p_field):
elif p_field == 'creationdate' or p_field == 'creation': elif p_field == 'creationdate' or p_field == 'creation':
# when a task has no creation date, push it to the end by assigning it # when a task has no creation date, push it to the end by assigning it
# the maximum possible date. # the maximum possible date.
result = (lambda a: a.creation_date() if a.creation_date() \ result = (lambda a: a.creation_date() if a.creation_date()
else date.max) else date.max)
elif p_field == 'done' or p_field == 'completed' or p_field == 'completion': elif p_field == 'done' or p_field == 'completed' or p_field == 'completion':
result = (lambda a: a.completion_date() if a.completion_date() \ result = (lambda a: a.completion_date() if a.completion_date()
else date.max) else date.max)
elif p_field == 'importance': elif p_field == 'importance':
result = importance result = importance
...@@ -56,7 +56,7 @@ def get_field_function(p_field): ...@@ -56,7 +56,7 @@ def get_field_function(p_field):
# try to find the corresponding tag # try to find the corresponding tag
# when a tag is not present, push it to the end of the list by giving # when a tag is not present, push it to the end of the list by giving
# it an artificially higher value # it an artificially higher value
result = (lambda a: "0" + a.tag_value(p_field) if a.has_tag(p_field) \ result = (lambda a: "0" + a.tag_value(p_field) if a.has_tag(p_field)
else "1") else "1")
return result return result
...@@ -116,8 +116,8 @@ class Sorter(object): ...@@ -116,8 +116,8 @@ class Sorter(object):
fields = self.sortstring.lower().split(',') fields = self.sortstring.lower().split(',')
for field in fields: for field in fields:
parsed_field = re.match( \ parsed_field = re.match(
r'(?P<order>(asc|desc)(ending)?:)?(?P<field>\S+)', \ r'(?P<order>(asc|desc)(ending)?:)?(?P<field>\S+)',
field) field)
if not parsed_field: if not parsed_field:
......
...@@ -69,7 +69,7 @@ class TodoBase(object): ...@@ -69,7 +69,7 @@ class TodoBase(object):
the given key-value combination. the given key-value combination.
""" """
result = [t for t in self.tag_values(p_key) \ result = [t for t in self.tag_values(p_key)
if p_value == "" or t == p_value] if p_value == "" or t == p_value]
return len(result) > 0 return len(result) > 0
...@@ -100,7 +100,7 @@ class TodoBase(object): ...@@ -100,7 +100,7 @@ class TodoBase(object):
if not p_force_add and value: if not p_force_add and value:
# remove old value from the tags # remove old value from the tags
self.fields['tags'] = [t for t in self.fields['tags'] \ self.fields['tags'] = [t for t in self.fields['tags']
if not (t[0] == p_key and t[1] == value)] if not (t[0] == p_key and t[1] == value)]
self.src = re.sub( self.src = re.sub(
...@@ -123,7 +123,7 @@ class TodoBase(object): ...@@ -123,7 +123,7 @@ class TodoBase(object):
# Build a new list that excludes the specified tag, match by value when # Build a new list that excludes the specified tag, match by value when
# p_value is given. # p_value is given.
self.fields['tags'] = [t for t in self.fields['tags'] \ self.fields['tags'] = [t for t in self.fields['tags']
if not (t[0] == p_key and (p_value == "" or if not (t[0] == p_key and (p_value == "" or
t[1] == p_value))] t[1] == p_value))]
...@@ -146,7 +146,7 @@ class TodoBase(object): ...@@ -146,7 +146,7 @@ class TodoBase(object):
the task was completed. the task was completed.
""" """
if not self.is_completed() and \ if not self.is_completed() and
(p_priority == None or is_valid_priority(p_priority)): (p_priority == None or is_valid_priority(p_priority)):
self.fields['priority'] = p_priority self.fields['priority'] = p_priority
...@@ -206,7 +206,7 @@ class TodoBase(object): ...@@ -206,7 +206,7 @@ class TodoBase(object):
self.fields['completed'] = True self.fields['completed'] = True
self.fields['completionDate'] = p_completion_date self.fields['completionDate'] = p_completion_date
self.src = re.sub(r'^(\([A-Z]\) )?', \ self.src = re.sub(r'^(\([A-Z]\) )?',
'x ' + p_completion_date.isoformat() + ' ', 'x ' + p_completion_date.isoformat() + ' ',
self.src) self.src)
...@@ -221,7 +221,7 @@ class TodoBase(object): ...@@ -221,7 +221,7 @@ class TodoBase(object):
# exceptions, hence the lambda # exceptions, hence the lambda
self.src = re.sub( self.src = re.sub(
r'^(x \d{4}-\d{2}-\d{2} |\([A-Z]\) )?(\d{4}-\d{2}-\d{2} )?(.*)$', r'^(x \d{4}-\d{2}-\d{2} |\([A-Z]\) )?(\d{4}-\d{2}-\d{2} )?(.*)$',
lambda m: \ lambda m:
u("{}{} {}").format(m.group(1) or '', p_date.isoformat(), u("{}{} {}").format(m.group(1) or '', p_date.isoformat(),
m.group(3)), self.src) m.group(3)), self.src)
......
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