# HG changeset patch # User Paul Boddie # Date 1439678165 -7200 # Node ID 4bf280ba1c3633853fbd012a177fd804b44ece1a # Parent e43d62cc38328842e051624fc7b669e2fc677d39 Added a get_duration method to periods. Removed the superfluous get_free_periods function. diff -r e43d62cc3832 -r 4bf280ba1c36 imiptools/period.py --- a/imiptools/period.py Sat Aug 15 22:58:59 2015 +0200 +++ b/imiptools/period.py Sun Aug 16 00:36:05 2015 +0200 @@ -79,6 +79,9 @@ def get_end_point(self): return self.end + def get_duration(self): + return self.get_end_point() - self.get_start_point() + class Period(PeriodBase): "A simple period abstraction." @@ -428,23 +431,6 @@ for replacement in replacements: insert_period(freebusy, replacement) -def get_free_periods(freebusy, period, overlapping=False): - - """ - Return periods from 'freebusy' within which the given 'period' could be - inserted. If 'overlapping' is true, only return free periods that overlap - 'period'. - """ - - free = invert_freebusy(freebusy) - if not free: - return None - - if overlapping: - return get_overlapping(free, period) - else: - return free - def coalesce_freebusy(freebusy): "Coalesce the periods in 'freebusy'."