When deleting a note, tag or folder
323847
function handleItemDelete(state, action) {
	let newState = Object.assign({}, state);

	const map = {
		'FOLDER_DELETE': ['folders', 'selectedFolderId'],
		'NOTE_DELETE': ['notes', 'selectedNoteIds'],
		'TAG_DELETE': ['tags', 'selectedTagId'],
		'SEARCH_DELETE': ['searches', 'selectedSearchId'],
	};

	const listKey = map[action.type][0];
	const selectedItemKey = map[action.type][1];

	let previousIndex = 0;
	let newItems = [];
	const items = state[listKey];
	for (let i = 0; i < items.length; i++) {
		let item = items[i];
		if (item.id == action.id) {
			previousIndex = i;
			continue;
		}
		newItems.push(item);
	}

	newState = Object.assign({}, state);
	newState[listKey] = newItems;

	if (previousIndex >= newItems.length) {
		previousIndex = newItems.length - 1;
	}

	const newId = previousIndex >= 0 ? newItems[previousIndex].id : null;
	newState[selectedItemKey] = action.type === 'NOTE_DELETE' ? [newId] : newId;

	if (!newId && newState.notesParentType !== 'Folder') {
		newState.notesParentType = 'Folder';
	}

	return newState;
}
1274878
def delete_attachment(request, link_field=None, uri=None):
    """"""
    if link_field is None:
        link_field = "record_uri"
    if uri is None:
        uri = record_uri(request)

    # Remove file.
    filters = [Filter(link_field, uri, core_utils.COMPARISON.EQ)]
    storage = request.registry.storage
    file_links, _ = storage.get_all("", FILE_LINKS, filters=filters)
    for link in file_links:
        request.attachment.delete(link['location'])

    # Remove link.
    storage.delete_all("", FILE_LINKS, filters=filters, with_deleted=False)
1175396
def delete(self, tag, **kwds):
        
        return self._client.post("/tag/%s/delete.json" %
                                 self._quote_url(self._extract_id(tag)),
                                 **kwds)["result"]
81912
public static function doCleanup()
    {
        Service::$log->msg('Cleanup started');
        foreach (self::$cleanupQueue as $cq) {
            Service::$log->msg(sprintf('Removing %s %s', $cq['type'], $cq['path']));

            if (strpos($cq['path'], self::$tempFolder) !== 0) {
                throw new \Exception(sprintf('Path "%s" is not within the defined temp folder location "%s".',
                    $cq['path'], self::$tempFolder));
            }

            if ($cq['type'] == self::TYPE_DIR) {
                system('rm -rf ' . $cq['path']);
            }

            if ($cq['type'] == self::TYPE_FILE) {
                system('rm ' . $cq['path']);
            }
        }

        Service::$log->msg('Cleanup ended');
    }
1121822
public function deleteFolder() {
        $folder=SnippetFolder::get()->byID(intval(str_replace('folder-', '', $this->request->getVar('ID'))));
        if(empty($folder) || $folder===false || $folder->ID==0) {
            $this->response->setStatusCode(404, _t('CodeBank.FOLDER_NOT_FOUND', '_Folder could not be found'));
            return;
        }
        
        
        $folder->delete();
        
        return 'HELO';
    }
732167
def note_revert(self, note_id, version):
        
        params = {'id': note_id, 'version': version}
        return self._get('note/revert', params, method='PUT')
914606
def remove_tag(self, task, params={}, **options): 
        
        path = "/tasks/%s/removeTag" % (task)
        return self.client.post(path, params, **options)
266945
def file_remove_tags(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/removeTags' % object_id, input_params, always_retry=always_retry, **kwargs)
174568
private function cleanup(): void
    {

        CharacterBlueprint::where('character_id', $this->getCharacterId())
            ->whereNotIn('item_id', $this->cleanup_ids->flatten()->unique()->all())
            ->delete();
    }
1285538
function handleFileDelete() {
        var entry = ProjectManager.getSelectedItem();
        Dialogs.showModalDialog(
            DefaultDialogs.DIALOG_ID_EXT_DELETED,
            Strings.CONFIRM_DELETE_TITLE,
            StringUtils.format(
                entry.isFile ? Strings.CONFIRM_FILE_DELETE : Strings.CONFIRM_FOLDER_DELETE,
                StringUtils.breakableUrl(entry.name)
            ),
            [
                {
                    className : Dialogs.DIALOG_BTN_CLASS_NORMAL,
                    id        : Dialogs.DIALOG_BTN_CANCEL,
                    text      : Strings.CANCEL
                },
                {
                    className : Dialogs.DIALOG_BTN_CLASS_PRIMARY,
                    id        : Dialogs.DIALOG_BTN_OK,
                    text      : Strings.DELETE
                }
            ]
        )
            .done(function (id) {
                if (id === Dialogs.DIALOG_BTN_OK) {
                    ProjectManager.deleteItem(entry);
                }
            });
    }
646554
def note_deletion(self, key):
        
        # If we'rew deleting a key we previously added, then there is no diff
        if key in self._added:
            self._added.remove(key)
        else:
            # If the deleted key was previously changed, use the original value
            if key in self._previous:
                self._deleted[key] = self._previous[key]
                del self._previous[key]
            else:
                self._deleted[key] = self._instance[key]
802045
function handleRemovedConfigItems(_a) {
    var fileInitialState = _a.fileInitialState, memoryInitialState = _a.memoryInitialState;
    var removedItems = memoryInitialState.filter(function (bsItem) {
        var removedItem = !fileInitialState.find(function (fileItem) { return bsItem.key === fileItem.key; });
        return removedItem;
    });
    if (removedItems.length > 0) {
        console.log('REMOVED CONFIG: ', removedItems);
    }
    removedItems.forEach(function (removedItem) {
        removeItemFromBrowserStorage(removedItem);
    });
}
846575
def delete_files(self, selections) -> None:
        """"""
        try:
            currentpath = self.currentpath
            for selection in selections:
                name = str(selection)
                if name == 'complete':
                    continue
                if not name.endswith('.py'):
                    name += '.py'
                path = os.path.join(currentpath, name)
                os.remove(path)
        except BaseException:
            objecttools.augment_excmessage(
                f'While trying to remove the network files of '
                f'selections `{selections}`')
251407
def del_tag(
            self,
            tag):
        

        if tag.replace("@", "") not in self.tags:
            return

        self.refresh
        oldContent = self.to_string(indentLevel=1)
        newTags = []
        newTags[:] = [n for n in newTags if tag not in n]
        self.tags = newTags
        newContent = self.to_string(indentLevel=1)

        # ADD DIRECTLY TO CONTENT IF THE PROJECT IS BEING ADDED SPECIFICALLY TO
        # THIS OBJECT
        self.parent._update_document_tree(
            oldContent=oldContent,
            newContent=newContent
        )

        self.refresh
        return None
141174
def remove_tag_all(self, resource_type, resource_id, **_params):
        """"""
        return self.delete(self.tags_path % (resource_type, resource_id))
1095452
public void delete() {
       if (historyId > 0) {
           try {
        	   // ZAP: Support for multiple tags
               staticTableTag.deleteTagsForHistoryID(historyId);
               staticTableHistory.delete(historyId);
               notifyEvent(HistoryReferenceEventPublisher.EVENT_REMOVED);
           } catch (DatabaseException e) {
        	   log.error(e.getMessage(), e);
           }
       }
   }
216563
def tag_del(self, item, tag):
        
        tags = list(self.item(item, "tags"))
        if tag in tags:
            tags.remove(tag)
            self.item(item, tags=tuple(tags))