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
02ca3e16
Commit
02ca3e16
authored
Nov 29, 2015
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'drop-python2'
Conflicts: setup.py topydo/lib/PrettyPrinterFilter.py
parents
f3aaef5c
94c11692
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
45 additions
and
130 deletions
+45
-130
.travis.yml
.travis.yml
+1
-8
setup.cfg
setup.cfg
+0
-2
setup.py
setup.py
+3
-11
test/test_add_command.py
test/test_add_command.py
+5
-7
test/test_delete_command.py
test/test_delete_command.py
+2
-4
test/test_depri_command.py
test/test_depri_command.py
+2
-4
test/test_do_command.py
test/test_do_command.py
+2
-4
test/test_edit_command.py
test/test_edit_command.py
+10
-12
test/test_get_sub_command.py
test/test_get_sub_command.py
+1
-3
test/test_list_command.py
test/test_list_command.py
+2
-4
test/test_postpone_command.py
test/test_postpone_command.py
+2
-4
test/test_priority_command.py
test/test_priority_command.py
+2
-4
test/test_revert_command.py
test/test_revert_command.py
+0
-1
test/test_todo_file.py
test/test_todo_file.py
+1
-3
topydo/cli/CLIApplicationBase.py
topydo/cli/CLIApplicationBase.py
+1
-12
topydo/cli/Prompt.py
topydo/cli/Prompt.py
+0
-6
topydo/commands/EditCommand.py
topydo/commands/EditCommand.py
+1
-3
topydo/lib/Config.py
topydo/lib/Config.py
+3
-18
topydo/lib/ListFormat.py
topydo/lib/ListFormat.py
+2
-4
topydo/lib/MultiCommand.py
topydo/lib/MultiCommand.py
+1
-3
topydo/lib/TodoBase.py
topydo/lib/TodoBase.py
+1
-3
topydo/lib/TodoListBase.py
topydo/lib/TodoListBase.py
+1
-3
topydo/lib/Utils.py
topydo/lib/Utils.py
+1
-4
topydo/lib/prettyprinters/Numbers.py
topydo/lib/prettyprinters/Numbers.py
+1
-3
No files found.
.travis.yml
View file @
02ca3e16
sudo
:
false
# run on new infrastructure
sudo
:
false
# run on new infrastructure
language
:
python
language
:
python
python
:
python
:
-
"
2.7"
-
"
3.2"
-
"
3.3"
-
"
3.3"
-
"
3.4"
-
"
3.4"
-
"
3.5"
-
"
3.5"
-
"
pypy"
-
"
pypy3"
-
"
pypy3"
matrix
:
allow_failures
:
-
python
:
"
3.2"
-
python
:
"
pypy"
-
python
:
"
pypy3"
install
:
install
:
-
"
python
-m
pip
install
pip
--upgrade"
-
"
python
-m
pip
install
pip
--upgrade"
-
"
pip
install
."
-
"
pip
install
."
-
"
pip
install
.[ical]"
-
"
pip
install
.[ical]"
-
"
pip
install
.[test]"
-
"
pip
install
.[test]"
-
"
pip
install
pylint"
-
"
pip
install
codecov"
-
"
pip
install
codecov"
script
:
script
:
-
"
green
-vvr"
-
"
green
-vvr"
...
...
setup.cfg
deleted
100644 → 0
View file @
f3aaef5c
[bdist_wheel]
universal = 1
setup.py
View file @
02ca3e16
...
@@ -20,7 +20,6 @@ def find_version(*file_paths):
...
@@ -20,7 +20,6 @@ def find_version(*file_paths):
return
version_match
.
group
(
1
)
return
version_match
.
group
(
1
)
raise
RuntimeError
(
"Unable to find version string."
)
raise
RuntimeError
(
"Unable to find version string."
)
setup
(
setup
(
name
=
"topydo"
,
name
=
"topydo"
,
packages
=
find_packages
(
exclude
=
[
"test"
]),
packages
=
find_packages
(
exclude
=
[
"test"
]),
...
@@ -30,22 +29,13 @@ setup(
...
@@ -30,22 +29,13 @@ setup(
author_email
=
"me@bramschoenmakers.nl"
,
author_email
=
"me@bramschoenmakers.nl"
,
url
=
"https://github.com/bram85/topydo"
,
url
=
"https://github.com/bram85/topydo"
,
install_requires
=
[
install_requires
=
[
'six >= 1.9.0'
,
'arrow >= 0.7.0'
,
'arrow >= 0.7.0'
,
],
],
extras_require
=
{
extras_require
=
{
':sys_platform=="win32"'
:
[
'colorama>=0.2.5'
],
':sys_platform=="win32"'
:
[
'colorama>=0.2.5'
],
# shutil.get_terminal_size() was introduced in Python 3.3
':python_version=="2.7"'
:
[
'backports.shutil_get_terminal_size>=1.0.0'
,
'ushlex'
,
],
':python_version=="3.2"'
:
[
'backports.shutil_get_terminal_size>=1.0.0'
],
'ical'
:
[
'icalendar'
],
'ical'
:
[
'icalendar'
],
'prompt-toolkit'
:
[
'prompt-toolkit >= 0.53'
],
'prompt-toolkit'
:
[
'prompt-toolkit >= 0.53'
],
'test'
:
[
'coverage'
,
'freezegun'
,
'green'
,
],
'test'
:
[
'coverage'
,
'freezegun'
,
'green'
,
],
'test:python_version=="2.7"'
:
[
'mock'
],
'test:python_version!="3.2"'
:
[
'pylint'
],
},
},
entry_points
=
{
entry_points
=
{
'console_scripts'
:
[
'topydo = topydo.cli.UILoader:main'
],
'console_scripts'
:
[
'topydo = topydo.cli.UILoader:main'
],
...
@@ -56,10 +46,12 @@ setup(
...
@@ -56,10 +46,12 @@ setup(
"Intended Audience :: End Users/Desktop"
,
"Intended Audience :: End Users/Desktop"
,
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)"
,
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)"
,
"Natural Language :: English"
,
"Natural Language :: English"
,
"Programming Language :: Python :: 2.7"
,
"Programming Language :: Python :: 3.2"
,
"Programming Language :: Python :: 3.2"
,
"Programming Language :: Python :: 3.3"
,
"Programming Language :: Python :: 3.3"
,
"Programming Language :: Python :: 3.4"
,
"Programming Language :: Python :: 3.4"
,
"Programming Language :: Python :: 3.5"
,
"Programming Language :: Python :: Implementation :: CPython"
,
"Programming Language :: Python :: Implementation :: PyPy"
,
"Topic :: Utilities"
,
"Topic :: Utilities"
,
],
],
long_description
=
"""
\
long_description
=
"""
\
...
...
test/test_add_command.py
View file @
02ca3e16
...
@@ -18,8 +18,6 @@ import unittest
...
@@ -18,8 +18,6 @@ import unittest
from
datetime
import
date
from
datetime
import
date
from
io
import
StringIO
from
io
import
StringIO
from
six
import
u
from
test.command_testcase
import
CommandTest
from
test.command_testcase
import
CommandTest
from
topydo.commands
import
AddCommand
,
ListCommand
from
topydo.commands
import
AddCommand
,
ListCommand
from
topydo.lib
import
TodoList
from
topydo.lib
import
TodoList
...
@@ -298,29 +296,29 @@ class AddCommandTest(CommandTest):
...
@@ -298,29 +296,29 @@ class AddCommandTest(CommandTest):
self
.
assertEqual
(
self
.
errors
,
command
.
usage
()
+
"
\
n
"
)
self
.
assertEqual
(
self
.
errors
,
command
.
usage
()
+
"
\
n
"
)
def
test_add_unicode
(
self
):
def
test_add_unicode
(
self
):
command
=
AddCommand
.
AddCommand
([
u
(
"Special
\
u25c4
"
)
],
self
.
todolist
,
command
=
AddCommand
.
AddCommand
([
u
"Special
\
u25c4
"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
self
.
out
,
self
.
error
)
command
.
execute
()
command
.
execute
()
self
.
assertEqual
(
self
.
output
,
self
.
assertEqual
(
self
.
output
,
u
(
"| 1| {} Special
\
u25c4
\
n
"
)
.
format
(
self
.
today
))
u
"| 1| {} Special
\
u25c4
\
n
"
.
format
(
self
.
today
))
self
.
assertEqual
(
self
.
errors
,
""
)
self
.
assertEqual
(
self
.
errors
,
""
)
@
mock
.
patch
(
"topydo.commands.AddCommand.stdin"
,
@
mock
.
patch
(
"topydo.commands.AddCommand.stdin"
,
StringIO
(
u
(
"Fo
\
u00f3
due:tod id:1
\
n
B
\
u0105
r before:1"
)
))
StringIO
(
u
"Fo
\
u00f3
due:tod id:1
\
n
B
\
u0105
r before:1"
))
def
test_add_from_stdin
(
self
):
def
test_add_from_stdin
(
self
):
command
=
AddCommand
.
AddCommand
([
"-f"
,
"-"
],
self
.
todolist
,
self
.
out
,
command
=
AddCommand
.
AddCommand
([
"-f"
,
"-"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
self
.
error
)
command
.
execute
()
command
.
execute
()
self
.
assertEqual
(
self
.
output
,
u
(
"| 1| {tod} Fo
\
u00f3
due:{tod} id:1
\
n
| 2| {tod} B
\
u0105
r p:1
\
n
"
.
format
(
tod
=
self
.
today
)
))
self
.
assertEqual
(
self
.
output
,
u
"| 1| {tod} Fo
\
u00f3
due:{tod} id:1
\
n
| 2| {tod} B
\
u0105
r p:1
\
n
"
.
format
(
tod
=
self
.
today
))
self
.
assertEqual
(
self
.
errors
,
""
)
self
.
assertEqual
(
self
.
errors
,
""
)
def
test_add_from_file
(
self
):
def
test_add_from_file
(
self
):
command
=
AddCommand
.
AddCommand
([
"-f"
,
"test/data/AddCommandTest-from_file.txt"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
=
AddCommand
.
AddCommand
([
"-f"
,
"test/data/AddCommandTest-from_file.txt"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
command
.
execute
()
self
.
assertEqual
(
self
.
output
,
u
(
"| 1| {tod} Foo @fo
\
u00f3
b
\
u0105
r due:{tod} id:1
\
n
| 2| {tod} Bar +baz t:{tod} p:1
\
n
"
.
format
(
tod
=
self
.
today
)
))
self
.
assertEqual
(
self
.
output
,
u
"| 1| {tod} Foo @fo
\
u00f3
b
\
u0105
r due:{tod} id:1
\
n
| 2| {tod} Bar +baz t:{tod} p:1
\
n
"
.
format
(
tod
=
self
.
today
))
self
.
assertEqual
(
self
.
errors
,
""
)
self
.
assertEqual
(
self
.
errors
,
""
)
def
test_add_task_without_date
(
self
):
def
test_add_task_without_date
(
self
):
...
...
test/test_delete_command.py
View file @
02ca3e16
...
@@ -16,8 +16,6 @@
...
@@ -16,8 +16,6 @@
import
unittest
import
unittest
from
six
import
u
from
test.command_testcase
import
CommandTest
from
test.command_testcase
import
CommandTest
from
topydo.commands.DeleteCommand
import
DeleteCommand
from
topydo.commands.DeleteCommand
import
DeleteCommand
from
topydo.lib.Config
import
config
from
topydo.lib.Config
import
config
...
@@ -179,14 +177,14 @@ class DeleteCommandTest(CommandTest):
...
@@ -179,14 +177,14 @@ class DeleteCommandTest(CommandTest):
"""
"""
Throw an error with invalid argument containing special characters.
Throw an error with invalid argument containing special characters.
"""
"""
command
=
DeleteCommand
([
u
(
"Fo
\
u00d3
B
\
u0105
r"
)
,
"Bar"
],
self
.
todolist
,
command
=
DeleteCommand
([
u
"Fo
\
u00d3
B
\
u0105
r"
,
"Bar"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
None
)
self
.
out
,
self
.
error
,
None
)
command
.
execute
()
command
.
execute
()
self
.
assertFalse
(
self
.
todolist
.
is_dirty
())
self
.
assertFalse
(
self
.
todolist
.
is_dirty
())
self
.
assertEqual
(
self
.
output
,
""
)
self
.
assertEqual
(
self
.
output
,
""
)
self
.
assertEqual
(
self
.
errors
,
self
.
assertEqual
(
self
.
errors
,
u
(
"Invalid todo number given: Fo
\
u00d3
B
\
u0105
r.
\
n
"
)
)
u
"Invalid todo number given: Fo
\
u00d3
B
\
u0105
r.
\
n
"
)
def
test_expr_del1
(
self
):
def
test_expr_del1
(
self
):
command
=
DeleteCommand
([
"-e"
,
"@test"
],
self
.
todolist
,
self
.
out
,
command
=
DeleteCommand
([
"-e"
,
"@test"
],
self
.
todolist
,
self
.
out
,
...
...
test/test_depri_command.py
View file @
02ca3e16
...
@@ -16,8 +16,6 @@
...
@@ -16,8 +16,6 @@
import
unittest
import
unittest
from
six
import
u
from
test.command_testcase
import
CommandTest
from
test.command_testcase
import
CommandTest
from
topydo.commands.DepriCommand
import
DepriCommand
from
topydo.commands.DepriCommand
import
DepriCommand
from
topydo.lib.TodoList
import
TodoList
from
topydo.lib.TodoList
import
TodoList
...
@@ -152,14 +150,14 @@ class DepriCommandTest(CommandTest):
...
@@ -152,14 +150,14 @@ class DepriCommandTest(CommandTest):
"""
"""
Throw an error with invalid argument containing special characters.
Throw an error with invalid argument containing special characters.
"""
"""
command
=
DepriCommand
([
u
(
"Fo
\
u00d3
B
\
u0105
r"
)
,
"Bar"
],
self
.
todolist
,
command
=
DepriCommand
([
u
"Fo
\
u00d3
B
\
u0105
r"
,
"Bar"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
None
)
self
.
out
,
self
.
error
,
None
)
command
.
execute
()
command
.
execute
()
self
.
assertFalse
(
self
.
todolist
.
is_dirty
())
self
.
assertFalse
(
self
.
todolist
.
is_dirty
())
self
.
assertFalse
(
self
.
output
)
self
.
assertFalse
(
self
.
output
)
self
.
assertEqual
(
self
.
errors
,
self
.
assertEqual
(
self
.
errors
,
u
(
"Invalid todo number given: Fo
\
u00d3
B
\
u0105
r.
\
n
"
)
)
u
"Invalid todo number given: Fo
\
u00d3
B
\
u0105
r.
\
n
"
)
def
test_empty
(
self
):
def
test_empty
(
self
):
command
=
DepriCommand
([],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
=
DepriCommand
([],
self
.
todolist
,
self
.
out
,
self
.
error
)
...
...
test/test_do_command.py
View file @
02ca3e16
...
@@ -17,8 +17,6 @@
...
@@ -17,8 +17,6 @@
import
unittest
import
unittest
from
datetime
import
date
,
timedelta
from
datetime
import
date
,
timedelta
from
six
import
u
from
test.command_testcase
import
CommandTest
from
test.command_testcase
import
CommandTest
from
topydo.commands.DoCommand
import
DoCommand
from
topydo.commands.DoCommand
import
DoCommand
from
topydo.lib.TodoList
import
TodoList
from
topydo.lib.TodoList
import
TodoList
...
@@ -383,13 +381,13 @@ class DoCommandTest(CommandTest):
...
@@ -383,13 +381,13 @@ class DoCommandTest(CommandTest):
"""
"""
Throw an error with invalid argument containing special characters.
Throw an error with invalid argument containing special characters.
"""
"""
command
=
DoCommand
([
u
(
"Fo
\
u00d3
B
\
u0105
r"
)
,
"Bar"
],
self
.
todolist
,
command
=
DoCommand
([
u
"Fo
\
u00d3
B
\
u0105
r"
,
"Bar"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
None
)
self
.
out
,
self
.
error
,
None
)
command
.
execute
()
command
.
execute
()
self
.
assertFalse
(
self
.
todolist
.
is_dirty
())
self
.
assertFalse
(
self
.
todolist
.
is_dirty
())
self
.
assertEqual
(
self
.
errors
,
self
.
assertEqual
(
self
.
errors
,
u
(
"Invalid todo number given: Fo
\
u00d3
B
\
u0105
r.
\
n
"
)
)
u
"Invalid todo number given: Fo
\
u00d3
B
\
u0105
r.
\
n
"
)
def
test_expr_do1
(
self
):
def
test_expr_do1
(
self
):
command
=
DoCommand
([
"-e"
,
"@test"
],
self
.
todolist
,
self
.
out
,
command
=
DoCommand
([
"-e"
,
"@test"
],
self
.
todolist
,
self
.
out
,
...
...
test/test_edit_command.py
View file @
02ca3e16
...
@@ -17,8 +17,6 @@
...
@@ -17,8 +17,6 @@
import
os
import
os
import
unittest
import
unittest
from
six
import
u
from
test.command_testcase
import
CommandTest
from
test.command_testcase
import
CommandTest
from
topydo.commands.EditCommand
import
EditCommand
from
topydo.commands.EditCommand
import
EditCommand
from
topydo.lib.Config
import
config
from
topydo.lib.Config
import
config
...
@@ -40,7 +38,7 @@ class EditCommandTest(CommandTest):
...
@@ -40,7 +38,7 @@ class EditCommandTest(CommandTest):
"Foo id:1"
,
"Foo id:1"
,
"Bar p:1 @test"
,
"Bar p:1 @test"
,
"Baz @test"
,
"Baz @test"
,
u
(
"Fo
\
u00f3
B
\
u0105
\
u017a
"
)
,
u
"Fo
\
u00f3
B
\
u0105
\
u017a
"
,
]
]
self
.
todolist
=
TodoList
(
todos
)
self
.
todolist
=
TodoList
(
todos
)
...
@@ -59,7 +57,7 @@ class EditCommandTest(CommandTest):
...
@@ -59,7 +57,7 @@ class EditCommandTest(CommandTest):
self
.
assertEqual
(
self
.
errors
,
""
)
self
.
assertEqual
(
self
.
errors
,
""
)
self
.
assertTrue
(
self
.
todolist
.
is_dirty
())
self
.
assertTrue
(
self
.
todolist
.
is_dirty
())
self
.
assertEqual
(
self
.
todolist
.
print_todos
(),
u
(
"Bar p:1 @test
\
n
Baz @test
\
n
Fo
\
u00f3
B
\
u0105
\
u017a
\
n
Foo id:1"
)
)
self
.
assertEqual
(
self
.
todolist
.
print_todos
(),
u
"Bar p:1 @test
\
n
Baz @test
\
n
Fo
\
u00f3
B
\
u0105
\
u017a
\
n
Foo id:1"
)
@
mock
.
patch
(
'topydo.commands.EditCommand._is_edited'
)
@
mock
.
patch
(
'topydo.commands.EditCommand._is_edited'
)
@
mock
.
patch
(
'topydo.commands.EditCommand.EditCommand._todos_from_temp'
)
@
mock
.
patch
(
'topydo.commands.EditCommand.EditCommand._todos_from_temp'
)
...
@@ -76,7 +74,7 @@ class EditCommandTest(CommandTest):
...
@@ -76,7 +74,7 @@ class EditCommandTest(CommandTest):
self
.
assertTrue
(
self
.
todolist
.
is_dirty
())
self
.
assertTrue
(
self
.
todolist
.
is_dirty
())
self
.
assertEqual
(
self
.
errors
,
""
)
self
.
assertEqual
(
self
.
errors
,
""
)
self
.
assertEqual
(
self
.
todolist
.
print_todos
(),
u
(
"Foo id:1
\
n
Baz @test
\
n
Fo
\
u00f3
B
\
u0105
\
u017a
\
n
Lazy Cat"
)
)
self
.
assertEqual
(
self
.
todolist
.
print_todos
(),
u
"Foo id:1
\
n
Baz @test
\
n
Fo
\
u00f3
B
\
u0105
\
u017a
\
n
Lazy Cat"
)
def
test_edit03
(
self
):
def
test_edit03
(
self
):
""" Throw an error after invalid todo number given as argument. """
""" Throw an error after invalid todo number given as argument. """
...
@@ -100,13 +98,13 @@ class EditCommandTest(CommandTest):
...
@@ -100,13 +98,13 @@ class EditCommandTest(CommandTest):
"""
"""
Throw an error with invalid argument containing special characters.
Throw an error with invalid argument containing special characters.
"""
"""
command
=
EditCommand
([
u
(
"Fo
\
u00d3
B
\
u0105
r"
)
,
"Bar"
],
self
.
todolist
,
command
=
EditCommand
([
u
"Fo
\
u00d3
B
\
u0105
r"
,
"Bar"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
None
)
self
.
out
,
self
.
error
,
None
)
command
.
execute
()
command
.
execute
()
self
.
assertFalse
(
self
.
todolist
.
is_dirty
())
self
.
assertFalse
(
self
.
todolist
.
is_dirty
())
self
.
assertEqual
(
self
.
errors
,
self
.
assertEqual
(
self
.
errors
,
u
(
"Invalid todo number given: Fo
\
u00d3
B
\
u0105
r.
\
n
"
)
)
u
"Invalid todo number given: Fo
\
u00d3
B
\
u0105
r.
\
n
"
)
@
mock
.
patch
(
'topydo.commands.EditCommand._is_edited'
)
@
mock
.
patch
(
'topydo.commands.EditCommand._is_edited'
)
@
mock
.
patch
(
'topydo.commands.EditCommand.EditCommand._todos_from_temp'
)
@
mock
.
patch
(
'topydo.commands.EditCommand.EditCommand._todos_from_temp'
)
...
@@ -117,14 +115,14 @@ class EditCommandTest(CommandTest):
...
@@ -117,14 +115,14 @@ class EditCommandTest(CommandTest):
mock_todos_from_temp
.
return_value
=
[
Todo
(
'Lazy Cat'
)]
mock_todos_from_temp
.
return_value
=
[
Todo
(
'Lazy Cat'
)]
mock_is_edited
.
return_value
=
True
mock_is_edited
.
return_value
=
True
command
=
EditCommand
([
u
(
"Fo
\
u00f3
B
\
u0105
\
u017a
"
)
],
self
.
todolist
,
command
=
EditCommand
([
u
"Fo
\
u00f3
B
\
u0105
\
u017a
"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
None
)
self
.
out
,
self
.
error
,
None
)
command
.
execute
()
command
.
execute
()
self
.
assertTrue
(
self
.
todolist
.
is_dirty
())
self
.
assertTrue
(
self
.
todolist
.
is_dirty
())
self
.
assertEqual
(
self
.
errors
,
""
)
self
.
assertEqual
(
self
.
errors
,
""
)
self
.
assertEqual
(
self
.
todolist
.
print_todos
(),
self
.
assertEqual
(
self
.
todolist
.
print_todos
(),
u
(
"Foo id:1
\
n
Bar p:1 @test
\
n
Baz @test
\
n
Lazy Cat"
)
)
u
"Foo id:1
\
n
Bar p:1 @test
\
n
Baz @test
\
n
Lazy Cat"
)
@
mock
.
patch
(
'topydo.commands.EditCommand._is_edited'
)
@
mock
.
patch
(
'topydo.commands.EditCommand._is_edited'
)
@
mock
.
patch
(
'topydo.commands.EditCommand.EditCommand._todos_from_temp'
)
@
mock
.
patch
(
'topydo.commands.EditCommand.EditCommand._todos_from_temp'
)
...
@@ -141,7 +139,7 @@ class EditCommandTest(CommandTest):
...
@@ -141,7 +139,7 @@ class EditCommandTest(CommandTest):
self
.
assertFalse
(
self
.
todolist
.
is_dirty
())
self
.
assertFalse
(
self
.
todolist
.
is_dirty
())
self
.
assertEqual
(
self
.
errors
,
"Editing aborted. Nothing to do.
\
n
"
)
self
.
assertEqual
(
self
.
errors
,
"Editing aborted. Nothing to do.
\
n
"
)
self
.
assertEqual
(
self
.
todolist
.
print_todos
(),
u
(
"Foo id:1
\
n
Bar p:1 @test
\
n
Baz @test
\
n
Fo
\
u00f3
B
\
u0105
\
u017a
"
)
)
self
.
assertEqual
(
self
.
todolist
.
print_todos
(),
u
"Foo id:1
\
n
Bar p:1 @test
\
n
Baz @test
\
n
Fo
\
u00f3
B
\
u0105
\
u017a
"
)
@
mock
.
patch
(
'topydo.commands.EditCommand._is_edited'
)
@
mock
.
patch
(
'topydo.commands.EditCommand._is_edited'
)
@
mock
.
patch
(
'topydo.commands.EditCommand.EditCommand._todos_from_temp'
)
@
mock
.
patch
(
'topydo.commands.EditCommand.EditCommand._todos_from_temp'
)
...
@@ -157,12 +155,12 @@ class EditCommandTest(CommandTest):
...
@@ -157,12 +155,12 @@ class EditCommandTest(CommandTest):
self
.
error
,
None
)
self
.
error
,
None
)
command
.
execute
()
command
.
execute
()
expected
=
u
(
"| 3| Lazy Cat
\
n
| 4| Lazy Dog
\
n
"
)
expected
=
u
"| 3| Lazy Cat
\
n
| 4| Lazy Dog
\
n
"
self
.
assertEqual
(
self
.
errors
,
""
)
self
.
assertEqual
(
self
.
errors
,
""
)
self
.
assertTrue
(
self
.
todolist
.
is_dirty
())
self
.
assertTrue
(
self
.
todolist
.
is_dirty
())
self
.
assertEqual
(
self
.
output
,
expected
)
self
.
assertEqual
(
self
.
output
,
expected
)
self
.
assertEqual
(
self
.
todolist
.
print_todos
(),
u
(
"Foo id:1
\
n
Fo
\
u00f3
B
\
u0105
\
u017a
\
n
Lazy Cat
\
n
Lazy Dog"
)
)
self
.
assertEqual
(
self
.
todolist
.
print_todos
(),
u
"Foo id:1
\
n
Fo
\
u00f3
B
\
u0105
\
u017a
\
n
Lazy Cat
\
n
Lazy Dog"
)
@
mock
.
patch
(
'topydo.commands.EditCommand.check_call'
)
@
mock
.
patch
(
'topydo.commands.EditCommand.check_call'
)
def
test_edit_archive
(
self
,
mock_call
):
def
test_edit_archive
(
self
,
mock_call
):
...
...
test/test_get_sub_command.py
View file @
02ca3e16
...
@@ -16,8 +16,6 @@
...
@@ -16,8 +16,6 @@
import
unittest
import
unittest
from
six
import
u
from
test.topydo_testcase
import
TopydoTest
from
test.topydo_testcase
import
TopydoTest
from
topydo.Commands
import
get_subcommand
from
topydo.Commands
import
get_subcommand
from
topydo.commands.AddCommand
import
AddCommand
from
topydo.commands.AddCommand
import
AddCommand
...
@@ -60,7 +58,7 @@ class GetSubcommandTest(TopydoTest):
...
@@ -60,7 +58,7 @@ class GetSubcommandTest(TopydoTest):
args
=
[
"smile"
]
args
=
[
"smile"
]
real_cmd
,
final_args
=
get_subcommand
(
args
)
real_cmd
,
final_args
=
get_subcommand
(
args
)
self
.
assertTrue
(
issubclass
(
real_cmd
,
ListCommand
))
self
.
assertTrue
(
issubclass
(
real_cmd
,
ListCommand
))
self
.
assertEqual
(
final_args
,
[
u
(
"
\
u263b
"
)
])
self
.
assertEqual
(
final_args
,
[
u
"
\
u263b
"
])
def
test_default_cmd01
(
self
):
def
test_default_cmd01
(
self
):
args
=
[
"bar"
]
args
=
[
"bar"
]
...
...
test/test_list_command.py
View file @
02ca3e16
...
@@ -18,8 +18,6 @@ import codecs
...
@@ -18,8 +18,6 @@ import codecs
import
re
import
re
import
unittest
import
unittest
from
six
import
u
from
test.command_testcase
import
CommandTest
from
test.command_testcase
import
CommandTest
from
test.facilities
import
load_file_to_todolist
from
test.facilities
import
load_file_to_todolist
from
topydo.commands.ListCommand
import
ListCommand
from
topydo.commands.ListCommand
import
ListCommand
...
@@ -338,13 +336,13 @@ class ListCommandUnicodeTest(CommandTest):
...
@@ -338,13 +336,13 @@ class ListCommandUnicodeTest(CommandTest):
def
test_list_unicode1
(
self
):
def
test_list_unicode1
(
self
):
""" Unicode filters."""
""" Unicode filters."""
command
=
ListCommand
([
u
(
"
\
u25c4
"
)
],
self
.
todolist
,
self
.
out
,
command
=
ListCommand
([
u
"
\
u25c4
"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
self
.
error
)
command
.
execute
()
command
.
execute
()
self
.
assertFalse
(
self
.
todolist
.
is_dirty
())
self
.
assertFalse
(
self
.
todolist
.
is_dirty
())
expected
=
u
(
"| 1| (C) And some sp
\
u00e9
cial tag:
\
u25c4
\
n
"
)
expected
=
u
"| 1| (C) And some sp
\
u00e9
cial tag:
\
u25c4
\
n
"
self
.
assertEqual
(
self
.
output
,
expected
)
self
.
assertEqual
(
self
.
output
,
expected
)
...
...
test/test_postpone_command.py
View file @
02ca3e16
...
@@ -17,8 +17,6 @@
...
@@ -17,8 +17,6 @@
import
unittest
import
unittest
from
datetime
import
date
,
timedelta
from
datetime
import
date
,
timedelta
from
six
import
u
from
test.command_testcase
import
CommandTest
from
test.command_testcase
import
CommandTest
from
topydo.commands.PostponeCommand
import
PostponeCommand
from
topydo.commands.PostponeCommand
import
PostponeCommand
from
topydo.lib.TodoList
import
TodoList
from
topydo.lib.TodoList
import
TodoList
...
@@ -252,14 +250,14 @@ class PostponeCommandTest(CommandTest):
...
@@ -252,14 +250,14 @@ class PostponeCommandTest(CommandTest):
def
test_postpone20
(
self
):
def
test_postpone20
(
self
):
""" Throw an error with invalid argument containing special characters. """
""" Throw an error with invalid argument containing special characters. """
command
=
PostponeCommand
([
u
(
"Fo
\
u00d3
B
\
u0105
r"
)
,
"Bar"
,
"1d"
],
command
=
PostponeCommand
([
u
"Fo
\
u00d3
B
\
u0105
r"
,
"Bar"
,
"1d"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
None
)
self
.
todolist
,
self
.
out
,
self
.
error
,
None
)
command
.
execute
()
command
.
execute
()
self
.
assertFalse
(
self
.
todolist
.
is_dirty
())
self
.
assertFalse
(
self
.
todolist
.
is_dirty
())
self
.
assertEqual
(
self
.
output
,
""
)
self
.
assertEqual
(
self
.
output
,
""
)
self
.
assertEqual
(
self
.
errors
,
self
.
assertEqual
(
self
.
errors
,
u
(
"Invalid todo number given: Fo
\
u00d3
B
\
u0105
r.
\
n
"
)
)
u
"Invalid todo number given: Fo
\
u00d3
B
\
u0105
r.
\
n
"
)
def
test_expr_postpone1
(
self
):
def
test_expr_postpone1
(
self
):
command
=
PostponeCommand
([
"-e"
,
"due:tod"
,
"2w"
],
self
.
todolist
,
command
=
PostponeCommand
([
"-e"
,
"due:tod"
,
"2w"
],
self
.
todolist
,
...
...
test/test_priority_command.py
View file @
02ca3e16
...
@@ -16,8 +16,6 @@
...
@@ -16,8 +16,6 @@
import
unittest
import
unittest
from
six
import
u
from
test.command_testcase
import
CommandTest
from
test.command_testcase
import
CommandTest
from
topydo.commands.PriorityCommand
import
PriorityCommand
from
topydo.commands.PriorityCommand
import
PriorityCommand
from
topydo.lib.TodoList
import
TodoList
from
topydo.lib.TodoList
import
TodoList
...
@@ -198,14 +196,14 @@ class PriorityCommandTest(CommandTest):
...
@@ -198,14 +196,14 @@ class PriorityCommandTest(CommandTest):
"""
"""
Throw an error with invalid argument containing special characters.
Throw an error with invalid argument containing special characters.
"""
"""
command
=
PriorityCommand
([
u
(
"Fo
\
u00d3
B
\
u0105
r"
)
,
"Bar"
,
"C"
],
command
=
PriorityCommand
([
u
"Fo
\
u00d3
B
\
u0105
r"
,
"Bar"
,
"C"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
None
)
self
.
todolist
,
self
.
out
,
self
.
error
,
None
)
command
.
execute
()
command
.
execute
()
self
.
assertFalse
(
self
.
todolist
.
is_dirty
())
self
.
assertFalse
(
self
.
todolist
.
is_dirty
())
self
.
assertEqual
(
self
.
output
,
""
)
self
.
assertEqual
(
self
.
output
,
""
)
self
.
assertEqual
(
self
.
errors
,
self
.
assertEqual
(
self
.
errors
,
u
(
"Invalid todo number given: Fo
\
u00d3
B
\
u0105
r.
\
n
"
)
)
u
"Invalid todo number given: Fo
\
u00d3
B
\
u0105
r.
\
n
"
)
def
test_invalid8
(
self
):
def
test_invalid8
(
self
):
"""
"""
...
...
test/test_revert_command.py
View file @
02ca3e16
...
@@ -20,7 +20,6 @@ import unittest
...
@@ -20,7 +20,6 @@ import unittest
from
datetime
import
date
from
datetime
import
date
from
glob
import
glob
from
glob
import
glob
from
six
import
u
from
uuid
import
uuid4
from
uuid
import
uuid4
from
test.command_testcase
import
CommandTest
from
test.command_testcase
import
CommandTest
...
...
test/test_todo_file.py
View file @
02ca3e16
...
@@ -16,8 +16,6 @@
...
@@ -16,8 +16,6 @@
import
unittest
import
unittest
from
six
import
u
from
test.facilities
import
load_file
from
test.facilities
import
load_file
from
test.topydo_testcase
import
TopydoTest
from
test.topydo_testcase
import
TopydoTest
...
@@ -32,7 +30,7 @@ class TodoFileTest(TopydoTest):
...
@@ -32,7 +30,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
()
topydo/cli/CLIApplicationBase.py
View file @
02ca3e16
...
@@ -21,8 +21,6 @@ I/O on the command-line.
...
@@ -21,8 +21,6 @@ I/O on the command-line.
import
getopt
import
getopt
import
sys
import
sys
from
six
import
PY2
from
six.moves
import
input
MAIN_OPTS
=
"ac:d:ht:v"
MAIN_OPTS
=
"ac:d:ht:v"
READ_ONLY_COMMANDS
=
(
'List'
,
'ListContext'
,
'ListProject'
)
READ_ONLY_COMMANDS
=
(
'List'
,
'ListContext'
,
'ListProject'
)
...
@@ -128,9 +126,6 @@ class CLIApplicationBase(object):
...
@@ -128,9 +126,6 @@ class CLIApplicationBase(object):
def
_process_flags
(
self
):
def
_process_flags
(
self
):
args
=
sys
.
argv
[
1
:]
args
=
sys
.
argv
[
1
:]
if
PY2
:
args
=
[
arg
.
decode
(
'utf-8'
)
for
arg
in
args
]
try
:
try
:
opts
,
args
=
getopt
.
getopt
(
args
,
MAIN_OPTS
)
opts
,
args
=
getopt
.
getopt
(
args
,
MAIN_OPTS
)
except
getopt
.
GetoptError
as
e
:
except
getopt
.
GetoptError
as
e
:
...
@@ -188,12 +183,6 @@ class CLIApplicationBase(object):
...
@@ -188,12 +183,6 @@ class CLIApplicationBase(object):
else
:
else
:
pass
# TODO
pass
# TODO
def
_input
(
self
):
"""
Returns a function that retrieves user input.
"""
return
input
def
is_read_only
(
self
,
p_command
):
def
is_read_only
(
self
,
p_command
):
""" Returns True when the given command class is read-only. """
""" Returns True when the given command class is read-only. """
read_only_commands
=
tuple
(
cmd
+
'Command'
for
cmd
in
(
'Revert'
,
)
+
read_only_commands
=
tuple
(
cmd
+
'Command'
for
cmd
in
(
'Revert'
,
)
+
...
@@ -216,7 +205,7 @@ class CLIApplicationBase(object):
...
@@ -216,7 +205,7 @@ class CLIApplicationBase(object):
self
.
todolist
,
self
.
todolist
,
lambda
o
:
write
(
sys
.
stdout
,
o
),
lambda
o
:
write
(
sys
.
stdout
,
o
),
error
,
error
,
self
.
_input
()
)
input
)
if
command
.
execute
()
!=
False
:
if
command
.
execute
()
!=
False
:
return
True
return
True
...
...
topydo/cli/Prompt.py
View file @
02ca3e16
...
@@ -24,13 +24,9 @@ from topydo.cli.CLIApplicationBase import CLIApplicationBase, error, usage
...
@@ -24,13 +24,9 @@ from topydo.cli.CLIApplicationBase import CLIApplicationBase, error, usage
from
topydo.cli.TopydoCompleter
import
TopydoCompleter
from
topydo.cli.TopydoCompleter
import
TopydoCompleter
from
prompt_toolkit.shortcuts
import
prompt
from
prompt_toolkit.shortcuts
import
prompt
from
prompt_toolkit.history
import
InMemoryHistory
from
prompt_toolkit.history
import
InMemoryHistory
from
six
import
PY2
from
topydo.lib.Config
import
config
,
ConfigError
from
topydo.lib.Config
import
config
,
ConfigError
if
PY2
:
import
ushlex
as
shlex
# First thing is to poke the configuration and check whether it's sane
# First thing is to poke the configuration and check whether it's sane
# The modules below may already read in configuration upon import, so
# The modules below may already read in configuration upon import, so
# make sure to bail out if the configuration is invalid.
# make sure to bail out if the configuration is invalid.
...
@@ -84,8 +80,6 @@ class PromptApplication(CLIApplicationBase):
...
@@ -84,8 +80,6 @@ class PromptApplication(CLIApplicationBase):
self
.
todolist
=
TodoList
.
TodoList
(
self
.
todofile
.
read
())
self
.
todolist
=
TodoList
.
TodoList
(
self
.
todofile
.
read
())
self
.
mtime
=
current_mtime
self
.
mtime
=
current_mtime
# suppress upstream issue with Python 2.7
# pylint: disable=no-value-for-parameter
self
.
completer
=
TopydoCompleter
(
self
.
todolist
)
self
.
completer
=
TopydoCompleter
(
self
.
todolist
)
def
run
(
self
):
def
run
(
self
):
...
...
topydo/commands/EditCommand.py
View file @
02ca3e16
...
@@ -18,8 +18,6 @@ import os
...
@@ -18,8 +18,6 @@ import os
import
tempfile
import
tempfile
from
subprocess
import
CalledProcessError
,
check_call
from
subprocess
import
CalledProcessError
,
check_call
from
six
import
u
from
topydo.lib.Config
import
config
from
topydo.lib.Config
import
config
from
topydo.lib.MultiCommand
import
MultiCommand
from
topydo.lib.MultiCommand
import
MultiCommand
from
topydo.lib.prettyprinters.Numbers
import
PrettyPrinterNumbers
from
topydo.lib.prettyprinters.Numbers
import
PrettyPrinterNumbers
...
@@ -97,7 +95,7 @@ class EditCommand(MultiCommand):
...
@@ -97,7 +95,7 @@ class EditCommand(MultiCommand):
if
len
(
self
.
invalid_numbers
)
>
1
or
len
(
self
.
invalid_numbers
)
>
0
and
len
(
self
.
todos
)
>
0
:
if
len
(
self
.
invalid_numbers
)
>
1
or
len
(
self
.
invalid_numbers
)
>
0
and
len
(
self
.
todos
)
>
0
:
for
number
in
self
.
invalid_numbers
:
for
number
in
self
.
invalid_numbers
:
errors
.
append
(
u
(
"Invalid todo number given: {}."
)
.
format
(
number
))
errors
.
append
(
u
"Invalid todo number given: {}."
.
format
(
number
))
elif
len
(
self
.
invalid_numbers
)
==
1
and
len
(
self
.
todos
)
==
0
:
elif
len
(
self
.
invalid_numbers
)
==
1
and
len
(
self
.
todos
)
==
0
:
errors
.
append
(
"Invalid todo number given."
)
errors
.
append
(
"Invalid todo number given."
)
...
...
topydo/lib/Config.py
View file @
02ca3e16
...
@@ -14,16 +14,10 @@
...
@@ -14,16 +14,10 @@
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import
configparser
import
os
import
os
import
shlex
import
shlex
from
six
import
iteritems
,
PY2
from
six.moves
import
configparser
if
PY2
:
import
ushlex
as
shlex
import
codecs
class
ConfigError
(
Exception
):
class
ConfigError
(
Exception
):
def
__init__
(
self
,
p_text
):
def
__init__
(
self
,
p_text
):
self
.
text
=
p_text
self
.
text
=
p_text
...
@@ -121,7 +115,7 @@ class _Config:
...
@@ -121,7 +115,7 @@ class _Config:
for
section
in
self
.
defaults
:
for
section
in
self
.
defaults
:
self
.
cp
.
add_section
(
section
)
self
.
cp
.
add_section
(
section
)
for
option
,
value
in
iteritems
(
self
.
defaults
[
section
]
):
for
option
,
value
in
self
.
defaults
[
section
].
items
(
):
self
.
cp
.
set
(
section
,
option
,
value
)
self
.
cp
.
set
(
section
,
option
,
value
)
files
=
[
files
=
[
...
@@ -137,16 +131,7 @@ class _Config:
...
@@ -137,16 +131,7 @@ class _Config:
if
p_path
is
not
None
:
if
p_path
is
not
None
:
files
=
[
p_path
]
files
=
[
p_path
]
if
PY2
:
for
path
in
files
:
try
:
with
codecs
.
open
(
path
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
self
.
cp
.
readfp
(
f
)
except
IOError
:
pass
else
:
self
.
cp
.
read
(
files
)
self
.
cp
.
read
(
files
)
self
.
_supplement_sections
()
self
.
_supplement_sections
()
if
p_overrides
:
if
p_overrides
:
...
...
topydo/lib/ListFormat.py
View file @
02ca3e16
...
@@ -19,8 +19,6 @@
...
@@ -19,8 +19,6 @@
import
arrow
import
arrow
import
re
import
re
from
six
import
u
from
topydo.lib.Config
import
config
from
topydo.lib.Config
import
config
from
topydo.lib.Utils
import
get_terminal_size
from
topydo.lib.Utils
import
get_terminal_size
...
@@ -162,13 +160,13 @@ class ListFormatParser(object):
...
@@ -162,13 +160,13 @@ class ListFormatParser(object):
# list of tags (spaces) without hidden ones and due: and t:
# list of tags (spaces) without hidden ones and due: and t:
'k'
:
lambda
t
:
' '
.
join
([
u
(
'{}:{}'
)
.
format
(
tag
,
value
)
'k'
:
lambda
t
:
' '
.
join
([
u
'{}:{}'
.
format
(
tag
,
value
)
for
tag
,
value
in
sorted
(
t
.
tags
())
if
for
tag
,
value
in
sorted
(
t
.
tags
())
if
tag
not
in
config
().
hidden_tags
()
+
tag
not
in
config
().
hidden_tags
()
+
[
config
().
tag_start
(),
config
().
tag_due
()]]),
[
config
().
tag_start
(),
config
().
tag_due
()]]),
# list of all tags (spaces)
# list of all tags (spaces)
'K'
:
lambda
t
:
' '
.
join
([
u
(
'{}:{}'
)
.
format
(
tag
,
value
)
'K'
:
lambda
t
:
' '
.
join
([
u
'{}:{}'
.
format
(
tag
,
value
)
for
tag
,
value
in
sorted
(
t
.
tags
())]),
for
tag
,
value
in
sorted
(
t
.
tags
())]),
# priority
# priority
...
...
topydo/lib/MultiCommand.py
View file @
02ca3e16
...
@@ -14,8 +14,6 @@
...
@@ -14,8 +14,6 @@
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from
six
import
u
from
topydo.lib.ExpressionCommand
import
ExpressionCommand
from
topydo.lib.ExpressionCommand
import
ExpressionCommand
from
topydo.lib.TodoListBase
import
InvalidTodoException
from
topydo.lib.TodoListBase
import
InvalidTodoException
...
@@ -90,7 +88,7 @@ class MultiCommand(ExpressionCommand):
...
@@ -90,7 +88,7 @@ class MultiCommand(ExpressionCommand):
if
len
(
self
.
invalid_numbers
)
>
1
or
len
(
self
.
invalid_numbers
)
>
0
and
len
(
self
.
todos
)
>
0
:
if
len
(
self
.
invalid_numbers
)
>
1
or
len
(
self
.
invalid_numbers
)
>
0
and
len
(
self
.
todos
)
>
0
:
for
number
in
self
.
invalid_numbers
:
for
number
in
self
.
invalid_numbers
:
errors
.
append
(
u
(
"Invalid todo number given: {}."
)
.
format
(
number
))
errors
.
append
(
u
"Invalid todo number given: {}."
.
format
(
number
))
elif
len
(
self
.
invalid_numbers
)
==
1
and
len
(
self
.
todos
)
==
0
:
elif
len
(
self
.
invalid_numbers
)
==
1
and
len
(
self
.
todos
)
==
0
:
errors
.
append
(
"Invalid todo number given."
)
errors
.
append
(
"Invalid todo number given."
)
elif
len
(
self
.
todos
)
==
0
and
len
(
self
.
invalid_numbers
)
==
0
:
elif
len
(
self
.
todos
)
==
0
and
len
(
self
.
invalid_numbers
)
==
0
:
...
...
topydo/lib/TodoBase.py
View file @
02ca3e16
...
@@ -21,8 +21,6 @@ This module contains the class that represents a single todo item.
...
@@ -21,8 +21,6 @@ This module contains the class that represents a single todo item.
import
re
import
re
from
datetime
import
date
from
datetime
import
date
from
six
import
u
from
topydo.lib.TodoParser
import
parse_line
from
topydo.lib.TodoParser
import
parse_line
from
topydo.lib.Utils
import
is_valid_priority
from
topydo.lib.Utils
import
is_valid_priority
...
@@ -218,7 +216,7 @@ class TodoBase(object):
...
@@ -218,7 +216,7 @@ class TodoBase(object):
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)
def creation_date(self):
def creation_date(self):
...
...
topydo/lib/TodoListBase.py
View file @
02ca3e16
...
@@ -21,8 +21,6 @@ A list of todo items.
...
@@ -21,8 +21,6 @@ A list of todo items.
import
re
import
re
from
datetime
import
date
from
datetime
import
date
from
six
import
text_type
from
topydo.lib
import
Filter
from
topydo.lib
import
Filter
from
topydo.lib.Config
import
config
from
topydo.lib.Config
import
config
from
topydo.lib.HashListValues
import
hash_list_values
from
topydo.lib.HashListValues
import
hash_list_values
...
@@ -128,7 +126,7 @@ class TodoListBase(object):
...
@@ -128,7 +126,7 @@ class TodoListBase(object):
if not result:
if not result:
# convert integer to text so we pass on a valid regex
# convert integer to text so we pass on a valid regex
result = todo_by_regexp(
text_type
(p_identifier))
result = todo_by_regexp(
str
(p_identifier))
return result
return result
...
...
topydo/lib/Utils.py
View file @
02ca3e16
...
@@ -59,10 +59,7 @@ def get_terminal_size():
...
@@ -59,10 +59,7 @@ def get_terminal_size():
Try to determine terminal size at run time. If that is not possible,
Try to determine terminal size at run time. If that is not possible,
returns the default size of 80x24.
returns the default size of 80x24.
"""
"""
try
:
from
shutil
import
get_terminal_size
# pylint: disable=no-name-in-module
from
shutil
import
get_terminal_size
# pylint: disable=no-name-in-module
except
ImportError
:
from
backports.shutil_get_terminal_size
import
get_terminal_size
try
:
try
:
sz
=
get_terminal_size
()
sz
=
get_terminal_size
()
...
...
topydo/lib/prettyprinters/Numbers.py
View file @
02ca3e16
...
@@ -16,8 +16,6 @@
...
@@ -16,8 +16,6 @@
""" Provides a pretty printer filter that inserts todo numbers. """
""" Provides a pretty printer filter that inserts todo numbers. """
from
six
import
u
from
topydo.lib.PrettyPrinterFilter
import
PrettyPrinterFilter
from
topydo.lib.PrettyPrinterFilter
import
PrettyPrinterFilter
...
@@ -30,5 +28,5 @@ class PrettyPrinterNumbers(PrettyPrinterFilter):
...
@@ -30,5 +28,5 @@ class PrettyPrinterNumbers(PrettyPrinterFilter):
def
filter
(
self
,
p_todo_str
,
p_todo
):
def
filter
(
self
,
p_todo_str
,
p_todo
):
""" Prepends the number to the todo string. """
""" Prepends the number to the todo string. """
return
u
(
"|{:>3}| {}"
)
.
format
(
self
.
todolist
.
number
(
p_todo
),
p_todo_str
)
return
"|{:>3}| {}"
.
format
(
self
.
todolist
.
number
(
p_todo
),
p_todo_str
)
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