def get_time_not_schedulable(self, start, end, blackouts=True): """ What is the set of time ([(start, end)]) in the given time window where this session is not schedulable? Here we consolidate all events so that we can use them to make calculations of the percentage of time available. """ # WTF? if self.project is None: return [] dts = set([]) dts = dts.union(self.get_receiver_blackout_ranges(start, end)) dts = dts.union(self.project.get_prescheduled_times(start, end)) if blackouts: dts = dts.union(self.project.get_blackout_times(start, end)) # the call to unions won't accept the None used # sometimes by get_receiver_blackout_range, so substitue in # the given boundries for these newDts = [] for (s, e) in list(dts): if s is None: s = start if e is None: e = end newDts.append((s, e)) return sorted(AnalogSet.unions(newDts))