Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
topydo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
topydo
Commits
ab290dad
Commit
ab290dad
authored
Oct 08, 2015
by
MinchinWeb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix PEP8 E502
the backslash is redundant between brackets
parent
c6b5ff49
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
37 additions
and
37 deletions
+37
-37
test/TestFilter.py
test/TestFilter.py
+9
-9
test/TestTodoBase.py
test/TestTodoBase.py
+1
-1
test/TestTodoFile.py
test/TestTodoFile.py
+1
-1
test/TestTodoList.py
test/TestTodoList.py
+14
-14
topydo/lib/Graph.py
topydo/lib/Graph.py
+1
-1
topydo/lib/Sorter.py
topydo/lib/Sorter.py
+5
-5
topydo/lib/TodoBase.py
topydo/lib/TodoBase.py
+6
-6
No files found.
test/TestFilter.py
View file @
ab290dad
...
...
@@ -41,7 +41,7 @@ class FilterTest(TopydoTest):
filtered_todos
=
grep
.
filter
(
todos
)
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
))
def
test_filter05
(
self
):
...
...
@@ -52,7 +52,7 @@ class FilterTest(TopydoTest):
filtered_todos
=
grep
.
filter
(
todos
)
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
))
def
test_filter06
(
self
):
...
...
@@ -63,7 +63,7 @@ class FilterTest(TopydoTest):
filtered_todos
=
grep
.
filter
(
todos
)
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
))
def
test_filter07
(
self
):
...
...
@@ -74,7 +74,7 @@ class FilterTest(TopydoTest):
filtered_todos
=
depfilter
.
filter
(
todolist
.
todos
())
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
))
def
test_filter08
(
self
):
...
...
@@ -85,7 +85,7 @@ class FilterTest(TopydoTest):
filtered_todos
=
grep
.
filter
(
todos
)
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
))
def
test_filter09
(
self
):
...
...
@@ -160,7 +160,7 @@ class FilterTest(TopydoTest):
filtered_todos
=
grep
.
filter
(
todos
)
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
))
def
test_filter17
(
self
):
...
...
@@ -172,7 +172,7 @@ class FilterTest(TopydoTest):
filtered_todos
=
andfilter
.
filter
(
todos
)
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
))
def
test_filter18
(
self
):
...
...
@@ -184,7 +184,7 @@ class FilterTest(TopydoTest):
filtered_todos
=
grep
.
filter
(
todos
)
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
))
def
test_filter20
(
self
):
...
...
@@ -194,7 +194,7 @@ class FilterTest(TopydoTest):
filtered_todos
=
otf
.
filter
(
todos
)
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
))
def
test_filter21
(
self
):
...
...
test/TestTodoBase.py
View file @
ab290dad
...
...
@@ -261,7 +261,7 @@ class TodoBaseTester(TopydoTest):
today_str
=
today
.
isoformat
()
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
))
def
test_set_complete3
(
self
):
...
...
test/TestTodoFile.py
View file @
ab290dad
test/TestTodoList.py
View file @
ab290dad
...
...
@@ -33,18 +33,18 @@ class TodoListTester(TopydoTest):
super
(
TodoListTester
,
self
).
setUp
()
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)]
self.text = ''.join(lines)
self.todolist = TodoListBase(lines)
def test_contexts(self):
self.assertEqual(set(['
Context1
', '
Context2
']),
\
self.assertEqual(set(['
Context1
', '
Context2
']),
self.todolist.contexts())
self.assertFalse(self.todolist.is_dirty())
def test_projects(self):
self.assertEqual(set(['
Project1
', '
Project2
']),
\
self.assertEqual(set(['
Project1
', '
Project2
']),
self.todolist.projects())
self.assertFalse(self.todolist.is_dirty())
...
...
@@ -54,9 +54,9 @@ class TodoListTester(TopydoTest):
todo = self.todolist.add(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.assertEqual(set(['
Context1
', '
Context2
', '
Context3
']),
\
self.assertEqual(set(['
Context1
', '
Context2
', '
Context3
']),
self.todolist.contexts())
self.assertEqual(self.todolist.number(todo), 6)
self.assertTrue(self.todolist.is_dirty())
...
...
@@ -99,7 +99,7 @@ class TodoListTester(TopydoTest):
todo = self.todolist.todo(2)
self.todolist.delete(todo)
self.assertEqual(self.todolist.todo(2).source(),
\
self.assertEqual(self.todolist.todo(2).source(),
"(C) Baz @Context1 +Project1 key:value")
self.assertEqual(self.todolist.count(), count - 1)
self.assertTrue(self.todolist.is_dirty())
...
...
@@ -119,9 +119,9 @@ class TodoListTester(TopydoTest):
todo = self.todolist.todo(3)
self.todolist.append(todo, "@Context3")
self.assertEqual(todo.source(),
\
self.assertEqual(todo.source(),
"(C) Baz @Context1 +Project1 key:value @Context3")
self.assertEqual(set(['
Context1
', '
Context2
', '
Context3
']),
\
self.assertEqual(set(['
Context1
', '
Context2
', '
Context3
']),
self.todolist.contexts())
self.assertTrue(self.todolist.is_dirty())
...
...
@@ -131,7 +131,7 @@ class TodoListTester(TopydoTest):
self.todolist.append(todo, "foo:bar")
self.assertEqual(todo.text(), text)
self.assertEqual(todo.source(),
\
self.assertEqual(todo.source(),
"(C) Baz @Context1 +Project1 key:value foo:bar")
def test_append3(self):
...
...
@@ -248,23 +248,23 @@ class TodoListDependencyTester(TopydoTest):
def test_check_dep(self):
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
']))
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
']))
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
'])
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
']))
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
'])
self.assertEqual(self.todolist.children(self.todolist.todo(2)), [])
...
...
topydo/lib/Graph.py
View file @
ab290dad
...
...
@@ -93,7 +93,7 @@ class DirectedGraph(object):
visited
.
add
(
current
)
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
]
stack
=
stack
+
parents
...
...
topydo/lib/Sorter.py
View file @
ab290dad
...
...
@@ -41,10 +41,10 @@ def get_field_function(p_field):
elif
p_field
==
'creationdate'
or
p_field
==
'creation'
:
# when a task has no creation date, push it to the end by assigning it
# 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
)
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
)
elif
p_field
==
'importance'
:
result
=
importance
...
...
@@ -56,7 +56,7 @@ def get_field_function(p_field):
# try to find the corresponding tag
# when a tag is not present, push it to the end of the list by giving
# 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"
)
return
result
...
...
@@ -116,8 +116,8 @@ class Sorter(object):
fields
=
self
.
sortstring
.
lower
().
split
(
','
)
for
field
in
fields
:
parsed_field
=
re
.
match
(
\
r'(?P<order>(asc|desc)(ending)?:)?(?P<field>\
S+)
',
\
parsed_field
=
re
.
match
(
r'(?P<order>(asc|desc)(ending)?:)?(?P<field>\
S+)
',
field)
if not parsed_field:
...
...
topydo/lib/TodoBase.py
View file @
ab290dad
...
...
@@ -69,7 +69,7 @@ class TodoBase(object):
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
]
return
len
(
result
)
>
0
...
...
@@ -100,7 +100,7 @@ class TodoBase(object):
if
not
p_force_add
and
value
:
# 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
)]
self
.
src
=
re
.
sub
(
...
...
@@ -123,7 +123,7 @@ class TodoBase(object):
# Build a new list that excludes the specified tag, match by value when
# 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
t
[
1
]
==
p_value
))]
...
...
@@ -146,7 +146,7 @@ class TodoBase(object):
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)):
self.fields['
priority
'] = p_priority
...
...
@@ -206,7 +206,7 @@ class TodoBase(object):
self.fields['
completed
'] = True
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() + '
',
self.src)
...
...
@@ -221,7 +221,7 @@ class TodoBase(object):
# exceptions, hence the lambda
self.src = re.sub(
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(),
m.group(3)), self.src)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment