mirror of
https://github.com/beetbox/beets.git
synced 2026-02-27 09:41:51 +01:00
consolidates the declaration and incrementing of ordinal into one line
This commit is contained in:
parent
85adbd1383
commit
4dbc4134b3
1 changed files with 2 additions and 3 deletions
|
|
@ -553,15 +553,14 @@ class Period(object):
|
|||
"""
|
||||
if not string:
|
||||
return None
|
||||
ordinal = 0
|
||||
date = None
|
||||
for date_format in cls.date_formats:
|
||||
for ordinal, date_format in enumerate(cls.date_formats):
|
||||
try:
|
||||
date = datetime.strptime(string, date_format)
|
||||
break
|
||||
except ValueError:
|
||||
# Parsing failed.
|
||||
ordinal += 1
|
||||
pass
|
||||
if date is None:
|
||||
raise InvalidQueryArgumentTypeError(string,
|
||||
'a valid datetime string')
|
||||
|
|
|
|||
Loading…
Reference in a new issue