Skip to content

Commit 3238c73

Browse files
author
Hugo Osvaldo Barrera
authored
Merge pull request #246 from pimutils/warnings
Clean up warnings
2 parents e3f9bf2 + 0c269c9 commit 3238c73

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

tests/test_config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ def test_xdg_nonexistant(runner):
3131

3232
def test_xdg_existant(runner, tmpdir, config):
3333
with tmpdir.mkdir('todoman').join('todoman.conf').open('w') as f:
34-
f.write(config.open().read())
34+
with config.open() as c:
35+
f.write(c.read())
3536

3637
with patch('xdg.BaseDirectory.xdg_config_dirs', [str(tmpdir)]):
3738
result = CliRunner().invoke(

todoman/cli.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ def wrapper(*a, **kw):
3636
with_id_arg = click.argument('id', type=click.IntRange(min=TODO_ID_MIN))
3737

3838

39-
def _validate_lists_param(ctx, param=None, lists=None):
40-
if lists:
41-
return [_validate_list_param(ctx, name=l) for l in lists]
39+
def _validate_lists_param(ctx, param=None, lists=[]):
40+
return [_validate_list_param(ctx, name=l) for l in lists]
4241

4342

4443
def _validate_list_param(ctx, param=None, name=None):

todoman/formatters.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ def __init__(self, date_format='%Y-%m-%d', time_format='%H:%M',
2424
self.tz = tz_override or tzlocal()
2525
self.now = datetime.datetime.now().replace(tzinfo=self.tz)
2626

27-
self._parsedatetime_calendar = parsedatetime.Calendar()
27+
self._parsedatetime_calendar = parsedatetime.Calendar(
28+
version=parsedatetime.VERSION_CONTEXT_STYLE,
29+
)
2830

2931
def simple_action(self, action, todo):
3032
return '{} "{}"'.format(action, todo.summary)
@@ -158,11 +160,9 @@ def _parse_datetime_naive(self, dt):
158160
except ValueError:
159161
pass
160162

161-
rv, certainty = self._parsedatetime_calendar.parse(dt)
162-
if not certainty:
163-
raise ValueError(
164-
'Time description not recognized: {}' .format(dt)
165-
)
163+
rv, pd_ctx = self._parsedatetime_calendar.parse(dt)
164+
if not pd_ctx.hasDateOrTime:
165+
raise ValueError('Time description not recognized: {}' .format(dt))
166166
return datetime.datetime.fromtimestamp(mktime(rv))
167167

168168
def format_database(self, database):

todoman/interactive.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ def __init__(self, todo, lists, formatter):
4747
grid = urwid.Pile(pile_items)
4848
spacer = urwid.Divider()
4949

50-
self.left_column = urwid.ListBox([
50+
self.left_column = urwid.ListBox(urwid.SimpleListWalker([
5151
grid,
5252
spacer,
5353
self._status,
5454
buttons,
55-
])
56-
right_column = urwid.ListBox(
55+
]))
56+
right_column = urwid.ListBox(urwid.SimpleListWalker(
5757
[urwid.Text('List:\n')] + self.list_selector
58-
)
58+
))
5959

6060
self._ui = urwid.Columns([self.left_column, right_column])
6161

0 commit comments

Comments
 (0)