diff --git a/lib/cylc/cycling/iso8601.py b/lib/cylc/cycling/iso8601.py index 49f2e808f42..19b58465f7e 100755 --- a/lib/cylc/cycling/iso8601.py +++ b/lib/cylc/cycling/iso8601.py @@ -34,7 +34,7 @@ CYCLER_TYPE_ISO8601 = "iso8601" CYCLER_TYPE_SORT_KEY_ISO8601 = "b" -MEMOIZE_LIMIT = 10000 +MEMOIZE_LIMIT = 100000 DATE_TIME_FORMAT = "CCYYMMDDThhmm" EXPANDED_DATE_TIME_FORMAT = "+XCCYYMMDDThhmm" @@ -321,7 +321,7 @@ class ISO8601Sequence(SequenceBase): TYPE = CYCLER_TYPE_ISO8601 TYPE_SORT_KEY = CYCLER_TYPE_SORT_KEY_ISO8601 - _MAX_CACHED_POINTS = 100 + _MAX_CACHED_POINTS = 1000 __slots__ = ('dep_section', 'context_start_point', 'context_end_point', 'offset', '_cached_first_point_values', diff --git a/lib/isodatetime/data.py b/lib/isodatetime/data.py index 539c070f570..eaecb0d3a9f 100644 --- a/lib/isodatetime/data.py +++ b/lib/isodatetime/data.py @@ -619,6 +619,15 @@ def copy(self): return TimeZone(hours=self.hours, minutes=self.minutes, unknown=self.unknown) + def __cmp__(self, other): + if not isinstance(other, TimeZone): + raise TypeError( + "Invalid type for comparison: " + + "'%s' should be TimePoint." % + type(other).__name__ + ) + return cmp((self.hours, self.minutes), (other.hours, other.minutes)) + def __str__(self): if self.unknown: return "" @@ -1301,8 +1310,6 @@ def __cmp__(self, other): raise TypeError( "Cannot compare truncated to non-truncated " + "TimePoint: %s, %s" % (self, other)) - if self.get_props() == other.get_props(): - return 0 if self.truncated: for attribute in self.DATA_ATTRIBUTES: other_attr = getattr(other, attribute) @@ -1310,8 +1317,9 @@ def __cmp__(self, other): if other_attr != self_attr: return cmp(self_attr, other_attr) return 0 - other = other.copy() - other.set_time_zone(self.get_time_zone()) + if other.get_time_zone() != self.get_time_zone(): + other = other.copy() + other.set_time_zone(self.get_time_zone()) if self.get_is_calendar_date(): my_date = self.get_calendar_date() other_date = other.get_calendar_date()