# HG changeset patch # User Paul Boddie # Date 1513460666 -3600 # Node ID b2af2d6aff53b928899c051136910185e664ad95 # Parent 68142c63482a30d18fb0d0dfa8f0fe89e80b5669 Removed special handling for UNTIL qualifiers in rules. diff -r 68142c63482a -r b2af2d6aff53 imiptools/data.py --- a/imiptools/data.py Sat Dec 16 22:01:04 2017 +0100 +++ b/imiptools/data.py Sat Dec 16 22:44:26 2017 +0100 @@ -1236,13 +1236,9 @@ if not selector: return iter([main_period]) - parameters = get_parameters(rrule) - until = parameters and parameters.get("UNTIL") or None - until = until and to_timezone(get_datetime(until), tzid) - # Obtain the periods generated by the rule. - rule_periods = get_periods_using_selector(selector, until, + rule_periods = get_periods_using_selector(selector, main_period, tzid, start, end, inclusive) @@ -1262,7 +1258,7 @@ return filter(lambda p, excluded=exdates: p not in excluded, periods) -def get_periods_using_selector(selector, until, main_period, tzid, start, end, +def get_periods_using_selector(selector, main_period, tzid, start, end, inclusive=False): # Filter periods using a start point. The period from the given start @@ -1270,7 +1266,7 @@ # included. The end will be handled in the materialisation process. return ifilter(Period(start, None).wraps, - RulePeriodCollection(selector, until, main_period, tzid, + RulePeriodCollection(selector, main_period, tzid, end, inclusive)) def get_main_period(periods): diff -r 68142c63482a -r b2af2d6aff53 imiptools/period.py --- a/imiptools/period.py Sat Dec 16 22:01:04 2017 +0100 +++ b/imiptools/period.py Sat Dec 16 22:44:26 2017 +0100 @@ -422,11 +422,11 @@ "A collection of rule periods." - def __init__(self, selector, until, main_period, tzid, end, inclusive=False): + def __init__(self, selector, main_period, tzid, end, inclusive=False): """ - Initialise a period collection for the given 'selectors', limited by any - 'until' datetime, employing the 'main_period' and 'tzid'. + Initialise a period collection for the given 'selectors', employing the + 'main_period' and 'tzid'. The specified 'end' datetime indicates the end of the window for which periods shall be computed. @@ -438,18 +438,8 @@ self.selector = selector self.main_period = main_period self.tzid = tzid - - # Any UNTIL qualifier changes the nature of the end of the collection. - - if until: - if to_datetime(end, tzid) < to_datetime(until, tzid): - self.end = end - else: - self.end = until - self.inclusive = True - else: - self.end = end - self.inclusive = inclusive + self.end = end + self.inclusive = inclusive def __iter__(self):