# HG changeset patch # User Paul Boddie # Date 1422143738 -3600 # Node ID 86708cc73d28dbc3f3024b32c4c322f20a4eda92 # Parent 2f494c872a4c52460ce447281098be1e0ff65bc7 Since a new time point will divide an existing period, propagate the preceding time point's period details. diff -r 2f494c872a4c -r 86708cc73d28 imiptools/period.py --- a/imiptools/period.py Sun Jan 25 00:29:40 2015 +0100 +++ b/imiptools/period.py Sun Jan 25 00:55:38 2015 +0100 @@ -226,8 +226,8 @@ """ Introduce into the 'slots' entries for those in 'points' that are not - already present, propagating active periods from time points preceding and - succeeding those added. + already present, propagating active periods from time points preceding + those added. """ new_slots = [] @@ -237,18 +237,7 @@ if i < len(slots) and slots[i][0] == point: continue - previously_active = i > 0 and slots[i-1] or [] - subsequently_active = i < len(slots) and slots[i] or [] - - active = [] - - for p, s in zip(previously_active, subsequently_active): - if p == s: - active.append(p) - else: - active.append(None) - - new_slots.append((point, active)) + new_slots.append((point, i > 0 and slots[i-1][1] or [])) for t in new_slots: insort_left(slots, t)