imip-agent

Changeset

1373:1aa3e8f9e5f1
2017-10-25 Paul Boddie raw files shortlog changelog graph Merged changes from the default branch. client-editing-simplification
imiptools/data.py (file)
     1.1 --- a/imiptools/data.py	Tue Oct 24 23:28:35 2017 +0200
     1.2 +++ b/imiptools/data.py	Wed Oct 25 00:10:09 2017 +0200
     1.3 @@ -1404,19 +1404,13 @@
     1.4  
     1.5      # Return a sorted list of the periods.
     1.6  
     1.7 -    periods = list(MergingIterator([rule_periods, iter(rdates or [])]))
     1.8 +    periods = MergingIterator([rule_periods, iter(rdates or [])])
     1.9  
    1.10      # Exclude exception dates.
    1.11  
    1.12 -    exdates = obj.get_date_value_item_periods("EXDATE")
    1.13 +    exdates = set(obj.get_date_value_item_periods("EXDATE", tzid) or [])
    1.14  
    1.15 -    if exdates:
    1.16 -        for period in exdates:
    1.17 -            i = bisect_left(periods, period)
    1.18 -            while i < len(periods) and periods[i] == period:
    1.19 -                del periods[i]
    1.20 -
    1.21 -    return periods
    1.22 +    return filter(lambda p, excluded=exdates: p not in excluded, periods)
    1.23  
    1.24  def get_main_period(periods):
    1.25