Skip to content

Commit

Permalink
more flake8 updates
Browse files Browse the repository at this point in the history
  • Loading branch information
discopatrick committed Apr 19, 2017
1 parent d466f88 commit 18c5128
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions beets/dbcore/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,13 +556,15 @@ def parse(cls, string):
ordinal = string.count('-')
if ordinal >= len(cls.date_formats):
# Too many components.
raise InvalidQueryArgumentTypeError(string, 'a valid datetime string')
raise InvalidQueryArgumentTypeError(string,
'a valid datetime string')
date_format = cls.date_formats[ordinal]
try:
date = datetime.strptime(string, date_format)
except ValueError:
# Parsing failed.
raise InvalidQueryArgumentTypeError(string, 'a valid datetime string')
raise InvalidQueryArgumentTypeError(string,
'a valid datetime string')
precision = cls.precisions[ordinal]
return cls(date, precision)

Expand Down

0 comments on commit 18c5128

Please sign in to comment.