From cf616ae6b8d0b81304fe87908ed6cfd1d0e53006 Mon Sep 17 00:00:00 2001 From: Adrian Coveney Date: Thu, 26 Feb 2015 16:49:13 +0000 Subject: Move line breaks after operators - Move line breaks to after operators as per PEP8 as Flake has started picking up on this in a newer version. --- src/isodate/duration.py | 26 +++++++++++++------------- src/isodate/isoduration.py | 10 +++++----- src/isodate/isotime.py | 20 ++++++++++---------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/isodate/duration.py b/src/isodate/duration.py index b44faa8..e3283b3 100644 --- a/src/isodate/duration.py +++ b/src/isodate/duration.py @@ -159,8 +159,8 @@ class Duration(object): newduration.tdelta = self.tdelta + other.tdelta return newduration if isinstance(other, (date, datetime)): - if (not(float(self.years).is_integer() - and float(self.months).is_integer())): + if (not(float(self.years).is_integer() and + float(self.months).is_integer())): raise ValueError('fractional years or months not supported' ' for date calculations') newmonth = other.month + self.months @@ -185,8 +185,8 @@ class Duration(object): newduration.tdelta = self.tdelta + other return newduration if isinstance(other, (date, datetime)): - if (not(float(self.years).is_integer() - and float(self.months).is_integer())): + if (not(float(self.years).is_integer() and + float(self.months).is_integer())): raise ValueError('fractional years or months not supported' ' for date calculations') newmonth = other.month + self.months @@ -226,8 +226,8 @@ class Duration(object): ''' # print '__rsub__:', self, other if isinstance(other, (date, datetime)): - if (not(float(self.years).is_integer() - and float(self.months).is_integer())): + if (not(float(self.years).is_integer() and + float(self.months).is_integer())): raise ValueError('fractional years or months not supported' ' for date calculations') newmonth = other.month - self.months @@ -258,8 +258,8 @@ class Duration(object): if not isinstance(other, Duration): return NotImplemented if (((self.years * 12 + self.months) == - (other.years * 12 + other.months) - and self.tdelta == other.tdelta)): + (other.years * 12 + other.months) and + self.tdelta == other.tdelta)): return True return False @@ -268,15 +268,15 @@ class Duration(object): If the years, month part or the timedelta part is not equal, then the two Durations are considered not equal. ''' - if ((isinstance(other, timedelta) - and self.years == 0 - and self.months == 0)): + if ((isinstance(other, timedelta) and + self.years == 0 and + self.months == 0)): return self.tdelta != other if not isinstance(other, Duration): return NotImplemented if (((self.years * 12 + self.months) != - (other.years * 12 + other.months) - or self.tdelta != other.tdelta)): + (other.years * 12 + other.months) or + self.tdelta != other.tdelta)): return True return False diff --git a/src/isodate/isoduration.py b/src/isodate/isoduration.py index af44661..5d51441 100644 --- a/src/isodate/isoduration.py +++ b/src/isodate/isoduration.py @@ -136,11 +136,11 @@ def duration_isoformat(tduration, format=D_DEFAULT): ''' # TODO: implement better decision for negative Durations. # should be done in Duration class in consistent way with timedelta. - if (((isinstance(tduration, Duration) - and (tduration.years < 0 or tduration.months < 0 - or tduration.tdelta < timedelta(0))) - or (isinstance(tduration, timedelta) - and (tduration < timedelta(0))))): + if (((isinstance(tduration, Duration) and + (tduration.years < 0 or tduration.months < 0 or + tduration.tdelta < timedelta(0))) or + (isinstance(tduration, timedelta) and + (tduration < timedelta(0))))): ret = '-' else: ret = '' diff --git a/src/isodate/isotime.py b/src/isodate/isotime.py index 2b268d0..9650cda 100644 --- a/src/isodate/isotime.py +++ b/src/isodate/isotime.py @@ -71,25 +71,25 @@ def build_time_regexps(): # hh:mm:ss.ss ... extended format TIME_REGEX_CACHE.append(re.compile(r"T?(?P[0-9]{2}):" r"(?P[0-9]{2}):" - r"(?P[0-9]{2}([,.][0-9]+)?)" - + TZ_REGEX)) + r"(?P[0-9]{2}" + r"([,.][0-9]+)?)" + TZ_REGEX)) # hhmmss.ss ... basic format TIME_REGEX_CACHE.append(re.compile(r"T?(?P[0-9]{2})" r"(?P[0-9]{2})" - r"(?P[0-9]{2}([,.][0-9]+)?)" - + TZ_REGEX)) + r"(?P[0-9]{2}" + r"([,.][0-9]+)?)" + TZ_REGEX)) # 2. reduced accuracy: # hh:mm.mm ... extended format TIME_REGEX_CACHE.append(re.compile(r"T?(?P[0-9]{2}):" - r"(?P[0-9]{2}([,.][0-9]+)?)" - + TZ_REGEX)) + r"(?P[0-9]{2}" + r"([,.][0-9]+)?)" + TZ_REGEX)) # hhmm.mm ... basic format TIME_REGEX_CACHE.append(re.compile(r"T?(?P[0-9]{2})" - r"(?P[0-9]{2}([,.][0-9]+)?)" - + TZ_REGEX)) + r"(?P[0-9]{2}" + r"([,.][0-9]+)?)" + TZ_REGEX)) # hh.hh ... basic format - TIME_REGEX_CACHE.append(re.compile(r"T?(?P[0-9]{2}([,.][0-9]+)?)" - + TZ_REGEX)) + TIME_REGEX_CACHE.append(re.compile(r"T?(?P[0-9]{2}" + r"([,.][0-9]+)?)" + TZ_REGEX)) return TIME_REGEX_CACHE -- cgit v1.2.1