diff options
author | F.N. Claessen <felix@seita.nl> | 2021-03-04 09:50:42 +0100 |
---|---|---|
committer | F.N. Claessen <felix@seita.nl> | 2021-03-04 09:50:42 +0100 |
commit | 43b894e61ca5c48b26124d284296779f85e44873 (patch) | |
tree | be25e79e80b9ebe896e1f8a7b524650d7adb3a5d /src/isodate/isoduration.py | |
parent | 7cfdffbf68fb20471a6c98f6ff9cc306c947b74e (diff) | |
download | isodate-43b894e61ca5c48b26124d284296779f85e44873.tar.gz |
Flake8
Diffstat (limited to 'src/isodate/isoduration.py')
-rw-r--r-- | src/isodate/isoduration.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/isodate/isoduration.py b/src/isodate/isoduration.py index 09846e1..38900a9 100644 --- a/src/isodate/isoduration.py +++ b/src/isodate/isoduration.py @@ -89,7 +89,11 @@ def parse_duration(datestring, as_timedelta_if_possible=True): # try alternative format: if datestring.startswith("P"): durdt = parse_datetime(datestring[1:]) - if as_timedelta_if_possible and durdt.year == 0 and durdt.month == 0: + if ( + as_timedelta_if_possible + and durdt.year == 0 + and durdt.month == 0 + ): # FIXME: currently not possible in alternative format # create timedelta ret = timedelta(days=durdt.day, seconds=durdt.second, @@ -115,7 +119,11 @@ def parse_duration(datestring, as_timedelta_if_possible=True): # these values are passed into a timedelta object, # which works with floats. groups[key] = float(groups[key][:-1].replace(',', '.')) - if as_timedelta_if_possible and groups["years"] == 0 and groups["months"] == 0: + if ( + as_timedelta_if_possible + and groups["years"] == 0 + and groups["months"] == 0 + ): ret = timedelta(days=groups["days"], hours=groups["hours"], minutes=groups["minutes"], seconds=groups["seconds"], weeks=groups["weeks"]) |