After deleting a reservation, delete the attendees and files
175429
public function onBeforeDelete()
    {
        // If a reservation is deleted remove the names from the guest list
        foreach ($this->Attendees() as $attendee) {
            /** @var Attendee $attendee */
            if ($attendee->exists()) {
                $attendee->delete();
            }
        }

        // Remove the folder
        if (($folder = Folder::get()->find('Name', $this->ReservationCode)) && $folder->exists() && $folder->isEmpty()) {
            $folder->delete();
        }

        parent::onBeforeDelete();
    }
39874
def purge(self):
        '''
        
        '''
        for table_name in self._db.list_tables():
            self._db.flush(table_name)

        self._run_init_queries()
82291
def delete_tickets(tickets)
      # TODO: Take Ticket objects, too, and pull out IDs.
      xml = make_xml('TicketDeleteRequest')
      tickets.each do |id|
        xml.add_element('Ticket', { 'id' => id })
      end

      (execute xml, '1.2').success
    end
895957
private void cleanUpAction() {

        try {
            m_model.deleteDescriptorIfNecessary();
        } catch (CmsException e) {
            LOG.error(m_messages.key(Messages.ERR_DELETING_DESCRIPTOR_0), e);
        }
        // unlock resource
        m_model.unlock();
    }
780516
public function deleteDuplicates()
    {
        $cron_schedule = Mage::getSingleton('core/resource')->getTableName('cron_schedule');
        $conn = Mage::getSingleton('core/resource')->getConnection('core_read');

        // TODO: Direct sql is not nice. We can do better... :)
        $results = $conn->fetchAll("
			SELECT
				GROUP_CONCAT(schedule_id) AS ids,
				CONCAT(job_code, scheduled_at) AS jobkey,
				count(*) AS qty
			FROM {$cron_schedule}
			WHERE status = '" . Aoe_Scheduler_Model_Schedule::STATUS_PENDING . "'
			GROUP BY jobkey
			HAVING qty > 1;
		");
        foreach ($results as $row) {
            $ids = explode(',', $row['ids']);
            $removeIds = array_slice($ids, 1);
            foreach ($removeIds as $id) {
                Mage::getModel('cron/schedule')->load($id)->delete();
            }
        }
    }
641543
protected function cleanRooms(): void
    {
        if (count($keys = $this->redis->keys("{$this->prefix}*"))) {
            $this->redis->del($keys);
        }
    }
300129
def cancel_reservation(self):
        
        room_res_line_obj = self.env['hotel.room.reservation.line']
        hotel_res_line_obj = self.env['hotel_reservation.line']
        self.state = 'cancel'
        room_reservation_line = room_res_line_obj.search([('reservation_id',
                                                           'in', self.ids)])
        room_reservation_line.write({'state': 'unassigned'})
        room_reservation_line.unlink()
        reservation_lines = hotel_res_line_obj.search([('line_id',
                                                        'in', self.ids)])
        for reservation_line in reservation_lines:
            reservation_line.reserve.write({'isroom': True,
                                            'status': 'available'})
        return True
1133508
function cleanupUpdates() {
        Object.keys(_idsToUpdate).forEach(function (id) {
            var installResult = _idsToUpdate[id],
                keepFile = installResult.keepFile,
                filename = installResult.localPath;

            if (filename && !keepFile) {
                FileSystem.getFileForPath(filename).unlink();
            }
        });
        _idsToUpdate = {};
    }
203288
function cleanupWorkFlowProcess()
    {
        $db = eZDB::instance();
        $workflowID = $this->attribute( 'id' );
        $event_list = $this->fetchEvents();
        if ( $event_list != null )
        {
            $existEventIDArray = array();
            foreach ( $event_list as $event )
            {
                $eventID = $event->attribute( 'id' );
                $existEventIDArray[] = $eventID;
            }
            $existEventIDString = implode( ',', $existEventIDArray );
            $db->query( "DELETE FROM ezworkflow_process
                               WHERE workflow_id=$workflowID
                                 AND event_id not in ( $existEventIDString )" );
        }
        else
        {
            $db->query( "DELETE FROM ezworkflow_process WHERE workflow_id=$workflowID" );
        }
    }
322150
def delete(name):
    '''
    '''
    with Session() as session:
        try:
            session.VFolder(name).delete()
            print_done('Deleted.')
        except Exception as e:
            print_error(e)
            sys.exit(1)
1277284
function cleanup() {

  var ds = application.dataStore;

  //delete the application's directory.  This will auto-delete any contained accounts and groups:
  ds.getResource(application.defaultAccountStoreMapping.href, function(err, mapping) {
    if (err) throw err;

    console.log('Retrieved application accountStoreMapping for deletion:');
    console.log(mapping);

    ds.deleteResource(mapping.accountStore, function(err) {
      if(err) throw err;

      console.log('Deleted application directory.');

      application.delete(function(err) {
        if (err) throw err;
        console.log('Deleted application.');
      });
    });
  });
}
765841
def remove(self, attendees):
        
        if isinstance(attendees, (list, tuple)):
            attendees = {
                attendee.address if isinstance(attendee, Attendee) else attendee
                for
                attendee in attendees}
        elif isinstance(attendees, str):
            attendees = {attendees}
        elif isinstance(attendees, Attendee):
            attendees = {attendees.address}
        else:
            raise ValueError('Incorrect parameter type for attendees')

        new_attendees = []
        for attendee in self.__attendees:
            if attendee.address not in attendees:
                new_attendees.append(attendee)
        self.__attendees = new_attendees
        self._track_changes()
615730
def delete(self):
        
        self.room.check_owner()
        self.conn.make_call("deleteFiles", [self.fid])
864578
def do_cleanup(connection, host_agent_id):
    '''
    
    '''
    desc = yield safe_get(connection, host_agent_id)
    if isinstance(desc, host.Descriptor):
        for partner in desc.partners:
            partner_desc = yield safe_get(connection, partner.recipient.key)
            if partner_desc:
                host_part = first(x for x in partner_desc.partners
                                  if x.role == 'host')
                if host_part is None:
                    log.warning('host_restart',
                                'Agent id: %s type: %s did not have any '
                                'host partner. So we are leaving it be.',
                                partner_desc.doc_id,
                                partner_desc.type_name)
                elif host_part.recipient.key == host_agent_id:
                    log.info('host_restart', "Deleting document with ID: %s",
                             partner_desc.doc_id)
                    yield connection.delete_document(partner_desc)
                else:
                    log.warning('host_restart',
                                "Not deleting descriptor of the agent id: %s, "
                                "agent_type: %s, as it seems to be hosted by "
                                "the host agent: %s. Although keep in mind "
                                "that he will not receive the goodbye "
                                "notification from us!",
                                partner_desc.doc_id,
                                partner_desc.type_name,
                                host_part.recipient.key)
        log.info('host_restart', "Deleting document with ID: %s",
                 desc.doc_id)
        yield connection.delete_document(desc)
914634
def delete_booking(self, sessionid, booking_id):
        
        url = "{}{}{}/".format(BASE_URL, "/delete/", booking_id)
        cookies = dict(sessionid=sessionid)

        try:
            resp = requests.get(url, cookies=cookies, headers={'Referer': '{}{}'.format(BASE_URL, "/reservations/")})
        except resp.exceptions.HTTPError as error:
            raise APIError("Server Error: {}".format(error))

        if resp.status_code == 404:
            raise APIError("Booking could not be found on server.")

        html = resp.content.decode("utf8")
        if "https://weblogin.pennkey.upenn.edu" in html:
            raise APIError("Wharton Auth Failed. Session ID is not valid.")

        resp.raise_for_status()

        soup = BeautifulSoup(html, "html5lib")
        middleware_token = soup.find("input", {'name': "csrfmiddlewaretoken"}).get('value')

        csrftoken = resp.cookies['csrftoken']
        cookies2 = {'sessionid': sessionid, 'csrftoken': csrftoken}
        headers = {'Referer': url}
        payload = {'csrfmiddlewaretoken': middleware_token}

        try:
            resp2 = requests.post(url, cookies=cookies2, data=payload, headers=headers)
        except resp2.exceptions.HTTPError as error:
            raise APIError("Server Error: {}".format(error))

        return {"success": True}
1303605
def _cleanup(self, domains):
        """"""
        for option in domains.values():
            try:
                os.remove(option['pot'])
            except (IOError, OSError):
                # It is not a problem if we can't actually remove the temporary file
                pass
1209016
function _delete(name) {
    observers[name].unobserve();
    delete observers[name];
    delete u        [name];
    delete shadow   [name];
  }