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
84581a0b
Commit
84581a0b
authored
Oct 08, 2015
by
MinchinWeb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix PEP8 E128
continuation line under-indented for visual indent
parent
b9b1038f
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
42 additions
and
43 deletions
+42
-43
test/TestFilter.py
test/TestFilter.py
+15
-15
test/TestRelativeDate.py
test/TestRelativeDate.py
+1
-2
test/TestTodoBase.py
test/TestTodoBase.py
+1
-1
test/TestTodoList.py
test/TestTodoList.py
+13
-13
topydo/commands/EditCommand.py
topydo/commands/EditCommand.py
+1
-1
topydo/lib/Config.py
topydo/lib/Config.py
+1
-1
topydo/lib/DCommand.py
topydo/lib/DCommand.py
+1
-1
topydo/lib/Graph.py
topydo/lib/Graph.py
+1
-1
topydo/lib/PrettyPrinterFilter.py
topydo/lib/PrettyPrinterFilter.py
+1
-1
topydo/lib/Sorter.py
topydo/lib/Sorter.py
+3
-3
topydo/lib/TodoBase.py
topydo/lib/TodoBase.py
+3
-3
topydo/lib/TodoList.py
topydo/lib/TodoList.py
+1
-1
No files found.
test/TestFilter.py
View file @
84581a0b
...
...
@@ -41,7 +41,7 @@ class FilterTest(TopydoTest):
reference
=
load_file
(
'test/data/FilterTest1a-result.txt'
)
self
.
assertEqual
(
todolist_to_string
(
filtered_todos
),
\
todolist_to_string
(
reference
))
todolist_to_string
(
reference
))
def
test_filter05
(
self
):
""" Test case sensitive match. """
...
...
@@ -52,7 +52,7 @@ class FilterTest(TopydoTest):
reference
=
load_file
(
'test/data/FilterTest1b-result.txt'
)
self
.
assertEqual
(
todolist_to_string
(
filtered_todos
),
\
todolist_to_string
(
reference
))
todolist_to_string
(
reference
))
def
test_filter06
(
self
):
""" Test case sensitive match (forced, with lowercase). """
...
...
@@ -63,7 +63,7 @@ class FilterTest(TopydoTest):
reference
=
load_file
(
'test/data/FilterTest1c-result.txt'
)
self
.
assertEqual
(
todolist_to_string
(
filtered_todos
),
\
todolist_to_string
(
reference
))
todolist_to_string
(
reference
))
def
test_filter07
(
self
):
""" Tests the dependency filter. """
...
...
@@ -74,7 +74,7 @@ class FilterTest(TopydoTest):
reference
=
load_file
(
'test/data/FilterTest2-result.txt'
)
self
.
assertEqual
(
todolist_to_string
(
filtered_todos
),
\
todolist_to_string
(
reference
))
todolist_to_string
(
reference
))
def
test_filter08
(
self
):
""" Test case sensitive match (forced, with lowercase). """
...
...
@@ -85,7 +85,7 @@ class FilterTest(TopydoTest):
reference
=
load_file
(
'test/data/FilterTest1a-result.txt'
)
self
.
assertEqual
(
todolist_to_string
(
filtered_todos
),
\
todolist_to_string
(
reference
))
todolist_to_string
(
reference
))
def
test_filter09
(
self
):
""" Test instance filter """
...
...
@@ -159,7 +159,7 @@ class FilterTest(TopydoTest):
reference
=
load_file
(
'test/data/FilterTest3-result.txt'
)
self
.
assertEqual
(
todolist_to_string
(
filtered_todos
),
\
todolist_to_string
(
reference
))
todolist_to_string
(
reference
))
def
test_filter17
(
self
):
todos
=
load_file
(
'test/data/FilterTest1.txt'
)
...
...
@@ -171,7 +171,7 @@ class FilterTest(TopydoTest):
reference
=
load_file
(
'test/data/FilterTest4-result.txt'
)
self
.
assertEqual
(
todolist_to_string
(
filtered_todos
),
\
todolist_to_string
(
reference
))
todolist_to_string
(
reference
))
def
test_filter18
(
self
):
todos
=
load_file
(
'test/data/FilterTest1.txt'
)
...
...
@@ -183,7 +183,7 @@ class FilterTest(TopydoTest):
reference
=
load_file
(
'test/data/FilterTest5-result.txt'
)
self
.
assertEqual
(
todolist_to_string
(
filtered_todos
),
\
todolist_to_string
(
reference
))
todolist_to_string
(
reference
))
def
test_filter20
(
self
):
todos
=
load_file
(
'test/data/FilterTest3.txt'
)
...
...
@@ -193,7 +193,7 @@ class FilterTest(TopydoTest):
reference
=
load_file
(
'test/data/FilterTest6-result.txt'
)
self
.
assertEqual
(
todolist_to_string
(
filtered_todos
),
\
todolist_to_string
(
reference
))
todolist_to_string
(
reference
))
def
test_filter21
(
self
):
todos
=
load_file
(
'test/data/FilterTest3.txt'
)
...
...
@@ -235,7 +235,7 @@ class FilterTest(TopydoTest):
reference
=
load_file
(
'test/data/FilterTest8-result.txt'
)
self
.
assertEqual
(
todolist_to_string
(
filtered_todos
),
todolist_to_string
(
reference
))
todolist_to_string
(
reference
))
def
test_filter26
(
self
):
todos
=
load_file
(
'test/data/FilterTest3.txt'
)
...
...
@@ -245,7 +245,7 @@ class FilterTest(TopydoTest):
reference
=
load_file
(
'test/data/FilterTest9-result.txt'
)
self
.
assertEqual
(
todolist_to_string
(
filtered_todos
),
todolist_to_string
(
reference
))
todolist_to_string
(
reference
))
def
test_filter27
(
self
):
todos
=
load_file
(
'test/data/FilterTest3.txt'
)
...
...
@@ -255,7 +255,7 @@ class FilterTest(TopydoTest):
reference
=
load_file
(
'test/data/FilterTest10-result.txt'
)
self
.
assertEqual
(
todolist_to_string
(
filtered_todos
),
todolist_to_string
(
reference
))
todolist_to_string
(
reference
))
def
test_filter28
(
self
):
todos
=
load_file
(
'test/data/FilterTest3.txt'
)
...
...
@@ -273,7 +273,7 @@ class FilterTest(TopydoTest):
reference
=
load_file
(
'test/data/FilterTest11-result.txt'
)
self
.
assertEqual
(
todolist_to_string
(
filtered_todos
),
todolist_to_string
(
reference
))
todolist_to_string
(
reference
))
def
test_filter30
(
self
):
todos
=
load_file
(
'test/data/FilterTest3.txt'
)
...
...
@@ -283,7 +283,7 @@ class FilterTest(TopydoTest):
reference
=
load_file
(
'test/data/FilterTest12-result.txt'
)
self
.
assertEqual
(
todolist_to_string
(
filtered_todos
),
todolist_to_string
(
reference
))
todolist_to_string
(
reference
))
def
test_filter31
(
self
):
todos
=
load_file
(
'test/data/FilterTest3.txt'
)
...
...
@@ -293,7 +293,7 @@ class FilterTest(TopydoTest):
reference
=
load_file
(
'test/data/FilterTest13-result.txt'
)
self
.
assertEqual
(
todolist_to_string
(
filtered_todos
),
todolist_to_string
(
reference
))
todolist_to_string
(
reference
))
class
OrdinalTagFilterTest
(
TopydoTest
):
def
setUp
(
self
):
...
...
test/TestRelativeDate.py
View file @
84581a0b
...
...
@@ -103,8 +103,7 @@ class RelativeDateTester(TopydoTest):
self
.
assertEqual
(
result
,
self
.
today
)
def
test_today3
(
self
):
result
=
relative_date_to_date
(
'today'
,
\
date
.
today
()
+
timedelta
(
1
))
result
=
relative_date_to_date
(
'today'
,
date
.
today
()
+
timedelta
(
1
))
self
.
assertEqual
(
result
,
self
.
today
)
def
test_tomorrow1
(
self
):
...
...
test/TestTodoBase.py
View file @
84581a0b
...
...
@@ -260,7 +260,7 @@ class TodoBaseTester(TopydoTest):
self
.
assertEqual
(
todo
.
fields
[
'completionDate'
],
today
)
self
.
assertTrue
(
re
.
match
(
'^x '
+
today_str
+
' 2014-06-12 Foo'
,
\
todo
.
src
))
todo
.
src
))
def
test_set_complete3
(
self
):
todo
=
TodoBase
(
"Foo"
)
...
...
test/TestTodoList.py
View file @
84581a0b
...
...
@@ -39,12 +39,12 @@ class TodoListTester(TopydoTest):
def test_contexts(self):
self.assertEqual(set(['
Context1
', '
Context2
']),
\
self.todolist.contexts())
self.todolist.contexts())
self.assertFalse(self.todolist.is_dirty())
def test_projects(self):
self.assertEqual(set(['
Project1
', '
Project2
']),
\
self.todolist.projects())
self.todolist.projects())
self.assertFalse(self.todolist.is_dirty())
def test_add1(self):
...
...
@@ -54,9 +54,9 @@ class TodoListTester(TopydoTest):
self.assertEqual(self.todolist.todo(count+1).source(), text)
self.assertEqual(set(['
Project1
', '
Project2
', '
Project3
']),
\
self.todolist.projects())
self.todolist.projects())
self.assertEqual(set(['
Context1
', '
Context2
', '
Context3
']),
\
self.todolist.contexts())
self.todolist.contexts())
self.assertEqual(self.todolist.number(todo), 6)
self.assertTrue(self.todolist.is_dirty())
...
...
@@ -97,7 +97,7 @@ class TodoListTester(TopydoTest):
self.todolist.delete(todo)
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.assertTrue(self.todolist.is_dirty())
self.assertRaises(InvalidTodoException, self.todolist.number, todo)
...
...
@@ -117,9 +117,9 @@ class TodoListTester(TopydoTest):
self.todolist.append(todo, "@Context3")
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.todolist.contexts())
self.todolist.contexts())
self.assertTrue(self.todolist.is_dirty())
def test_append2(self):
...
...
@@ -129,7 +129,7 @@ class TodoListTester(TopydoTest):
self.assertEqual(todo.text(), text)
self.assertEqual(todo.source(),
\
"(C) Baz @Context1 +Project1 key:value foo:bar")
"(C) Baz @Context1 +Project1 key:value foo:bar")
def test_append3(self):
todo = self.todolist.todo(3)
...
...
@@ -242,23 +242,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]),
\
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)
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))
self.assertEqual(sorted([todo.source() for todo in children]),
\
['
Buzz
p
:
2
'])
['
Buzz
p
:
2
'])
parents = self.todolist.parents(self.todolist.todo(4))
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)
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.parents(self.todolist.todo(1)), [])
...
...
topydo/commands/EditCommand.py
View file @
84581a0b
...
...
@@ -37,7 +37,7 @@ BASE_TODOLIST = lambda tl: super(TodoList, tl)
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
,
p_error
,
p_input
)
p_error
,
p_input
)
if
len
(
self
.
args
)
==
0
:
self
.
multi_mode
=
False
...
...
topydo/lib/Config.py
View file @
84581a0b
...
...
@@ -198,7 +198,7 @@ class _Config:
hidden_tags
=
self
.
cp
.
get
(
'ls'
,
'hide_tags'
)
# pylint: disable=no-member
return
[]
if
hidden_tags
==
''
else
[
tag
.
strip
()
for
tag
in
hidden_tags
.
split
(
','
)]
hidden_tags
.
split
(
','
)]
def
priority_colors
(
self
):
""" Returns a dict with priorities as keys and color numbers as value. """
...
...
topydo/lib/DCommand.py
View file @
84581a0b
...
...
@@ -91,7 +91,7 @@ class DCommand(MultiCommand):
just before that point.
"""
return
[
todo
for
todo
in
self
.
todolist
.
todos
()[:
self
.
length
]
if
not
self
.
_uncompleted_children
(
todo
)
and
todo
.
is_active
()]
if
not
self
.
_uncompleted_children
(
todo
)
and
todo
.
is_active
()]
def
condition
(
self
,
_
):
"""
...
...
topydo/lib/Graph.py
View file @
84581a0b
...
...
@@ -93,7 +93,7 @@ class DirectedGraph(object):
if
p_reverse
:
parents
=
[
node
for
node
,
neighbors
in
self
.
_edges
.
items
()
\
if
current
in
neighbors
]
if
current
in
neighbors
]
stack
=
stack
+
parents
result
=
result
.
union
(
parents
)
...
...
topydo/lib/PrettyPrinterFilter.py
View file @
84581a0b
...
...
@@ -114,6 +114,6 @@ class PrettyPrinterHideTagFilter(PrettyPrinterFilter):
for hidden_tag in self.hidden_tags:
# inspired from remove_tag in TodoBase
p_todo_str = re.sub(r'
\
s?
\
b' + hidden_tag + r':
\
S+
\
b', '',
p_todo_str)
p_todo_str)
return p_todo_str
topydo/lib/Sorter.py
View file @
84581a0b
...
...
@@ -40,10 +40,10 @@ def get_field_function(p_field):
# 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
()
\
else
date
.
max
)
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
()
\
else
date
.
max
)
else
date
.
max
)
elif
p_field
==
'importance'
:
result
=
importance
elif
p_field
==
'importance-avg'
or
p_field
==
'importance-average'
:
...
...
@@ -55,7 +55,7 @@ def get_field_function(p_field):
# 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
)
\
else
"1"
)
else
"1"
)
return
result
...
...
topydo/lib/TodoBase.py
View file @
84581a0b
...
...
@@ -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'
]
\
if
not
(
t
[
0
]
==
p_key
and
t
[
1
]
==
value
)]
if
not
(
t
[
0
]
==
p_key
and
t
[
1
]
==
value
)]
self
.
src
=
re
.
sub
(
r'\b'
+
p_key
+
':'
+
value
+
r'\b'
,
...
...
@@ -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'
]
\
if
not
(
t
[
0
]
==
p_key
and
(
p_value
==
""
or
t
[
1
]
==
p_value
))]
if
not
(
t
[
0
]
==
p_key
and
(
p_value
==
""
or
t
[
1
]
==
p_value
))]
# when value == "", match any value having key p_key
value
=
p_value
if
p_value
!=
""
else
r'\
S+
'
...
...
@@ -205,7 +205,7 @@ class TodoBase(object):
self.fields['
completionDate
'] = p_completion_date
self.src = re.sub(r'
^
(
\
([
A
-
Z
]
\
)
)
?
',
\
'
x
' + p_completion_date.isoformat() + '
', self.src)
'
x
' + p_completion_date.isoformat() + '
', self.src)
def set_creation_date(self, p_date=date.today()):
"""
...
...
topydo/lib/TodoList.py
View file @
84581a0b
...
...
@@ -207,7 +207,7 @@ class TodoList(TodoListBase):
def
clean_by_tag
(
tag_name
):
""" Generic function to handle 'p' and 'id' tags. """
for
todo
in
[
todo
for
todo
in
self
.
_todos
if
todo
.
has_tag
(
tag_name
)]:
if
todo
.
has_tag
(
tag_name
)]:
value
=
todo
.
tag_value
(
tag_name
)
if
not
self
.
_depgraph
.
has_edge_id
(
value
):
...
...
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