From 4dbc4134b315650786d5667991e5e0198100eaff Mon Sep 17 00:00:00 2001 From: discopatrick Date: Fri, 21 Apr 2017 12:55:44 +0100 Subject: [PATCH] consolidates the declaration and incrementing of `ordinal` into one line --- beets/dbcore/query.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/beets/dbcore/query.py b/beets/dbcore/query.py index 13aca762d..8ce4dac41 100644 --- a/beets/dbcore/query.py +++ b/beets/dbcore/query.py @@ -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')