# HG changeset patch # User Paul Boddie # Date 1425248297 -3600 # Node ID eca3f63a629f44b41cd56c3edb69a77816829844 # Parent c591f1c62df621a66d75e9ed6c416aef35568539 Added docstrings. diff -r c591f1c62df6 -r eca3f63a629f imiptools/period.py --- a/imiptools/period.py Sun Mar 01 22:00:09 2015 +0100 +++ b/imiptools/period.py Sun Mar 01 23:18:17 2015 +0100 @@ -62,9 +62,18 @@ return False def insert_period(freebusy, period): + + "Insert into 'freebusy' the given 'period'." + insort_left(freebusy, period) def remove_period(freebusy, uid, recurrenceid=None): + + """ + Remove from 'freebusy' all periods associated with 'uid' and 'recurrenceid' + (which if omitted causes the "parent" object's periods to be referenced). + """ + i = 0 while i < len(freebusy): t = freebusy[i] @@ -74,6 +83,14 @@ i += 1 def remove_affected_period(freebusy, uid, recurrenceid): + + """ + Remove from 'freebusy' a period associated with 'uid' that provides an + occurrence starting at the given 'recurrenceid', where the recurrence + identifier is used to provide an alternative time period whilst also acting + as a reference to the originally-defined occurrence. + """ + found = bisect_left(freebusy, (recurrenceid,)) if found < len(freebusy): start, end, _uid, transp, _recurrenceid = freebusy[found][:5]