Find the next time this appointment should be scheduled.

        Delete any nonrecurring record that just happened.
174200
def updateNexttime(self, now):
        '''
        
        '''
        if self._recidxnexttime is not None and not self.recur:
            del self.recs[self._recidxnexttime]

        while self.recs and self.nexttime <= now:

            lowtime = 999999999999.9

            # Find the lowest next time of all of our recs (backwards, so we can delete)
            for i in range(len(self.recs) - 1, -1, -1):
                rec = self.recs[i]
                nexttime = rec.nexttime(self.nexttime)
                if nexttime == 0.0:
                    # We blew by and missed a fixed-year appointment, either due to clock shenanigans, this query going
                    # really long, or the initial requirement being in the past
                    logger.warning(f'Missed an appointment: {rec}')
                    del self.recs[i]
                    continue
                if nexttime < lowtime:
                    lowtime = nexttime
                    lowidx = i

            if not self.recs:
                break

            self._recidxnexttime = lowidx
            self.nexttime = lowtime

        if not self.recs:
            self._recidxnexttime = None
            self.nexttime = None
            return
98339
async def delete(self, iden):
        '''
        
        '''
        appt = self.appts.get(iden)
        if appt is None:
            raise s_exc.NoSuchIden()

        try:
            heappos = self.apptheap.index(appt)
        except ValueError:
            pass  # this is OK, just a non-recurring appt that has no more records
        else:
            # If we're already the last item, just delete it
            if heappos == len(self.apptheap) - 1:
                del self.apptheap[heappos]
            else:
                # put the last item at the current position and reheap
                self.apptheap[heappos] = self.apptheap.pop()
                heapq.heapify(self.apptheap)

        del self.appts[iden]
        await self._hivedict.pop(iden)
1132328
def _delete_record(self, identifier=None, rtype=None, name=None, content=None):
        
        if not identifier:
            records = self._list_records(rtype, name, content)
            identifiers = [record["id"] for record in records]
        else:
            identifiers = [identifier]

        LOGGER.debug("delete_records: %s", identifiers)

        for record_id in identifiers:
            self._delete(
                "/v1/domains/{0}/records/{1}".format(
                    self.domain, record_id
                )
            )
            LOGGER.debug("delete_record: %s", record_id)

        LOGGER.debug("delete_record: %s", True)
        return True
640358
def postpone(self, record):
		

		maximum_records = self.maximum_records()
		if maximum_records is not None and len(self.__records) >= maximum_records:
			record.task_dropped()
			return

		task_policy = record.policy()
		task_group_id = record.task_group_id()

		if task_policy == WScheduleRecord.PostponePolicy.wait:
			self.__postpone_record(record)

		elif task_policy == WScheduleRecord.PostponePolicy.drop:
			record.task_dropped()

		elif task_policy == WScheduleRecord.PostponePolicy.postpone_first:
			if task_group_id is None:
				self.__postpone_record(record)
			else:
				record_found = None
				for previous_scheduled_record, task_index in self.__search_record(task_group_id):
					if previous_scheduled_record.policy() != task_policy:
						raise RuntimeError('Invalid tasks policies')
					record_found = previous_scheduled_record
					break

				if record_found is not None:
					record.task_dropped()
				else:
					self.__postpone_record(record)

		elif task_policy == WScheduleRecord.PostponePolicy.postpone_last:
			if task_group_id is None:
				self.__postpone_record(record)
			else:
				record_found = None
				for previous_scheduled_record, task_index in self.__search_record(task_group_id):
					if previous_scheduled_record.policy() != task_policy:
						raise RuntimeError('Invalid tasks policies')
					record_found = task_index
					break

				if record_found is not None:
					self.__records.pop(record_found).task_dropped()

				self.__postpone_record(record)
		else:
			raise RuntimeError('Invalid policy spotted')
611291
def skip_if_needed(self, job_record):
        
        tree = self.get_tree(job_record.process_name)
        node = tree.get_node(job_record.process_name, job_record.timeperiod)
        if tree.should_skip_tree_node(node):
            self.skip_tree_node(node)
1070043
def delete(self,removed):
        
        if isinstance(removed,dict):
            # remove a single record
            removed = [removed]
        else:
            # convert iterable into a list (to be able to sort it)
            removed = [ r for r in removed ]
        if not removed:
            return 0
        _ids = [ r['__id__'] for r in removed ]
        _ids.sort()
        keys = set(self.records.keys())
        # check if the records are in the base
        if not set(_ids).issubset(keys):
            missing = list(set(_ids).difference(keys))
            raise IndexError,'Delete aborted. Records with these ids' \
                ' not found in the base : %s' %str(missing)
        # raise exception if duplicate ids
        for i in range(len(_ids)-1):
            if _ids[i] == _ids[i+1]:
                raise IndexError,"Delete aborted. Duplicate id : %s" %_ids[i]
        deleted = len(removed)
        while removed:
            r = removed.pop()
            _id = r['__id__']
            # remove id from indices
            for indx in self.indices.keys():
                pos = bisect.bisect(self.indices[indx][r[indx]],_id)-1
                del self.indices[indx][r[indx]][pos]
                if not self.indices[indx][r[indx]]:
                    del self.indices[indx][r[indx]]
            # remove record from self.records
            del self.records[_id]
        return deleted
46088
def remove_all_events(self, calendar_id):
        ''''''
        # todo: incomplete

        now = datetime.now(tz=self.timezone) # timezone?
        start_time = datetime(year=now.year - 1, month=now.month, day=now.day, hour=now.hour, minute=now.minute, second=now.second, tzinfo=self.timezone)
        end_time = datetime(year=now.year + 1, month=now.month, day=now.day, hour=now.hour, minute=now.minute, second=now.second, tzinfo=self.timezone)
        start_time = start_time.isoformat()
        end_time = end_time.isoformat()


        #events = self.service.events().list(calendarId = self.configured_calendar_ids[calendar_id], showDeleted = False).execute()
        events = self.service.events().list(calendarId = self.configured_calendar_ids[calendar_id], timeMin = start_time, timeMax = end_time, showDeleted = False).execute()

        print(len(events['items']))

        for event in events['items']:
            dt = None
            nb = DeepNonStrictNestedBunch(event)
            #print(event)
            if (nb.summary or nb.description or '').find('presentation') != -1:
                print(nb.id)
                print(nb.summary or nb.description)
                print(nb.start)
183660
def business_hours_schedule_delete(self, id, **kwargs):
        ""
        api_path = "/api/v2/business_hours/schedules/{id}.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, method="DELETE", **kwargs)
1042678
public function cleanupAction()
    {
        $params = $this->_processParameters($this->showParameters);
        $params['contentTitle'] = $this->_('Clean up existing appointments?');
        $params['filterOn']     = 'gap_id_procedure';
        $params['filterWhen']   = 'gap_filter';

        $snippets = array(
            'Generic\\ContentTitleSnippet',
            'Agenda\\AppointmentCleanupSnippet',
            'Agenda_CalendarTableSnippet',
            );

        $this->addSnippets($snippets, $params);
    }
708055
private void unschedule() {
        synchronized (mutex) {
            if (pendingFuture != null && !pendingFuture.isDone() && !pendingFuture.isCancelled()) {
                Log.v(Log.TAG_BATCHER, "%s: cancelling the pending future ...", this);
                pendingFuture.cancel(false);
            }
            scheduled = false;
        }
    }
675646
public boolean removeRecord(Rec record)
    {
        if (m_vRecordList == null)
            return false;
        boolean bFlag = m_vRecordList.removeRecord(record);
        if (((Record)record).getRecordOwner() == this)
            ((Record)record).setRecordOwner(null);
        return bFlag;
    }
754792
private void cleanUsingTime(final String metricName, final Date firstAllowedDate) {
    if (this.historyListMapping.containsKey(metricName)
        && this.historyListMapping.get(metricName) != null) {
      synchronized (this.historyListMapping.get(metricName)) {

        InMemoryHistoryNode firstNode = this.historyListMapping.get(metricName).peekFirst();
        long localCopyOfTimeWindow = 0;

        // go ahead for clean up using latest possible value of interval
        // any interval change will not affect on going clean up
        synchronized (this) {
          localCopyOfTimeWindow = this.timeWindow;
        }

        // removing objects older than Interval time from firstAllowedDate
        while (firstNode != null
            && TimeUnit.MILLISECONDS
            .toMillis(firstAllowedDate.getTime() - firstNode.getTimestamp().getTime())
            > localCopyOfTimeWindow) {
          this.historyListMapping.get(metricName).removeFirst();
          firstNode = this.historyListMapping.get(metricName).peekFirst();
        }
      }
    }
  }
637816
def cleanup(self):
        
        date_cur_ = datetime.now()
        for seq in (self._mv_cookie, self._mv):
            for k in list(seq.keys()):
                if (date_cur_ - seq[k][1]) > timedelta(minutes=1):
                    log.debug('Cleanup: deleting entry %s', seq[k][0])
                    del seq[k]
397001
public function removeScheduledAliases()
    {
        foreach ($this->scheduledRemoveAlias as $alias) {
            $this->aliasing->removeAlias($alias);
        }

        $this->scheduledRemoveAlias = [];
    }
363470
@Override
    public Record nextRecord() {
        Record next = sequenceRecordReader.nextRecord();
        next.setRecord(transformProcess.execute(next.getRecord()));
        return next;
    }
276937
def maybe_clean(self):
        """"""

        now = time.time()
        if self.next_cleaning <= now:
            keys_to_delete = []
            for (k, v) in self.data.iteritems():
                if v.expiration <= now:
                    keys_to_delete.append(k)
            for k in keys_to_delete:
                del self.data[k]
            now = time.time()
            self.next_cleaning = now + self.cleaning_interval
1099424
protected void cleanupCurrentRecord() throws IOException {
        if (this.currentRecord != null) {
            this.currentRecord.close();
            gotoEOR(this.currentRecord);
            this.currentRecord = null;
        }
    }