Get the delete set if any from the plf and process each delete command removing any that fail
from the delete set so that the delete set is self cleaning.
198773
static void applyAndUpdateDeleteSet(Document plf, Document ilf, IntegrationResult result) {

        Element dSet = null;
        try {
            dSet = getDeleteSet(plf, null, false);
        } catch (Exception e) {
            LOG.error("Exception occurred while getting user's DLM delete-set.", e);
        }

        if (dSet == null) return;

        NodeList deletes = dSet.getChildNodes();

        for (int i = deletes.getLength() - 1; i >= 0; i--) {
            if (applyDelete((Element) deletes.item(i), ilf) == false) {
                dSet.removeChild(deletes.item(i));
                result.setChangedPLF(true);
            } else {
                result.setChangedILF(true);
            }
        }

        if (dSet.getChildNodes().getLength() == 0) {
            plf.getDocumentElement().removeChild(dSet);
            result.setChangedPLF(true);
        }
    }
345790
def _recursive_cleanup(foo):
    
    if isinstance(foo, dict):
        for (key, val) in list(foo.items()):
            if isinstance(val, dict):
                _recursive_cleanup(val)
            if val == "" or val == [] or val == {}:
                del foo[key]
675314
public List<DynamoDBMapper.FailedBatch> batchDelete(Iterable<T> objectsToDelete) {
        return mapper.batchWrite((Iterable<T>)Collections.<T>emptyList(), objectsToDelete);
    }
364041
async def delete(self, *names):
        
        count = 0

        for arg in names:
            count += await self.execute_command('DEL', arg)

        return count
39302
private List getClearDeletedModes() {

        ArrayList ret = new ArrayList();

        ret.add(
            new CmsSelectWidgetOption(
                MODE_CLEANDELETED_KEEP_RESTORE_VERSION,
                getClearDeletedMode().equals(MODE_CLEANDELETED_KEEP_RESTORE_VERSION),
                key(Messages.GUI_HISTORY_CLEAR_DELETED_KEEPRESTORE_0)));
        ret.add(new CmsSelectWidgetOption(
            MODE_CLEANDELETED_DELETE_ALL,
            getClearDeletedMode().equals(MODE_CLEANDELETED_DELETE_ALL),
            key(Messages.GUI_HISTORY_CLEAR_DELETED_DELETEALL_0)));
        ret.add(new CmsSelectWidgetOption(
            MODE_CLEANDELETED_DELETE_NONE,
            getClearDeletedMode().equals(MODE_CLEANDELETED_DELETE_NONE),
            key(Messages.GUI_HISTORY_CLEAR_DELETED_DELETENONE_0)));

        return ret;
    }
1338164
def delete(options = {})
      return each({ match: '*', count: 500, max_iterations: 1_000_000, batch_size: 500 }.merge(options)) do |keys|
        @connection.del(*keys)
      end
    end
355975
def clean(self):
        """"""
        super(AtLeastOneRequiredInlineFormSet, self).clean()
        if any(self.errors):
            return
        if not any(cleaned_data and not cleaned_data.get('DELETE', False) for cleaned_data in self.cleaned_data):
            raise forms.ValidationError('Прикрепите не менее одного документа')
1155820
public void cleanup() {
        List<String> keys = new ArrayList<>(created.keySet());
        keys.sort(String::compareTo);
        for (String key : keys) {
            created.remove(key)
                .stream()
                .sorted(Comparator.comparing(HasMetadata::getKind))
                .forEach(metadata -> {
                    log.info(String.format("Deleting %s : %s", key, metadata.getKind()));
                    deleteWithRetries(metadata);
                });
        }
    }
559936
def cleanup(self):
        
        remove = []
        for handle, assoc in self.assocs.items():
            if assoc.expiresIn == 0:
                remove.append(handle)
        for handle in remove:
            del self.assocs[handle]
        return len(remove), len(self.assocs)
24813
def _find_set_members(set):
    '''
    
    '''

    cmd = '{0} list {1}'.format(_ipset_cmd(), set)
    out = __salt__['cmd.run_all'](cmd, python_shell=False)

    if out['retcode'] > 0:
        # Set doesn't exist return false
        return False

    _tmp = out['stdout'].split('\n')
    members = []
    startMembers = False
    for i in _tmp:
        if startMembers:
            members.append(i)
        if 'Members:' in i:
            startMembers = True
    return members
1255756
function delete()
  {
    $v_result=1;

    // ----- Reset the error handler
    $this->privErrorReset();

    // ----- Check archive
    if (!$this->privCheckFormat()) {
      return(0);
    }

    // ----- Set default values
    $v_options = array();

    // ----- Look for variable options arguments
    $v_size = func_num_args();

    // ----- Look for arguments
    if ($v_size > 0) {
      // ----- Get the arguments
      $v_arg_list = func_get_args();

      // ----- Parse the options
      $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
                                        array (PCLZIP_OPT_BY_NAME => 'optional',
                                               PCLZIP_OPT_BY_EREG => 'optional',
                                               PCLZIP_OPT_BY_PREG => 'optional',
                                               PCLZIP_OPT_BY_INDEX => 'optional' ));
      if ($v_result != 1) {
          return 0;
      }
    }

    // ----- Magic quotes trick
    $this->privDisableMagicQuotes();

    // ----- Call the delete fct
    $v_list = array();
    if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1) {
      $this->privSwapBackMagicQuotes();
      unset($v_list);
      return(0);
    }

    // ----- Magic quotes trick
    $this->privSwapBackMagicQuotes();

    // ----- Return
    return $v_list;
  }
805656
def cleanup(self):
        
        if getattr(self._finalizer, "detach", None) and self._finalizer.detach():
            if os.path.exists(self.path):
                try:
                    rmtree(self.path)
                except OSError:
                    pass
                else:
                    self.path = None
434374
def cleanup(self):
        
        empty_keys = [k for k, v in self.items() if not v]

        for k in empty_keys:
            del self[k]
153740
public function actionCleanup()
    {
        $tagIds = Tag::find()->select(['id'])->column();

        $batch = TagRelation::find()->batch();
        $i = 0;
        $delete = 0;
        foreach ($batch as $rows) {
            foreach ($rows as $relation) {
                $i++;
                // check if tag id exists in table
                if (!in_array($relation->tag_id, $tagIds)) {
                    $relation->delete();
                    $delete++;
                    continue;
                }

                $prefixedTableName = '{{%'.$relation->table_name.'}}';
                $pk = $this->tableSchema($prefixedTableName)->primaryKey;
                $query = (new Query())
                    ->from($prefixedTableName)
                    ->where([current($pk) => $relation->pk_id]) // provide model mapping or read pk name from schema
                    ->exists();

                if (!$query) {
                    $relation->delete();
                    $delete++;
                }

                unset($relation, $prefixedTableName, $pk, $query);
            }
        }

        return $this->outputSuccess("{$i} items checked and {$delete} items deleted.");
    }
287510
protected function flushDeletes()
    {
        if ( ! $this->deleteTarget) {
            return;
        }

        foreach ($this->queuedForDelete as $variant) {
            $this->handler->deleteVariant($this->deleteTarget, $variant);
        }

        $this->queuedForDelete = [];
    }
452835
def Delete(self):
		

		disk_set = [{'diskId': o.id, 'sizeGB': o.size} for o in self.parent.disks if o!=self]
		self.parent.disks = [o for o in self.parent.disks if o!=self]
		self.parent.server.dirty = True
		return(clc.v2.Requests(clc.v2.API.Call('PATCH','servers/%s/%s' % (self.parent.server.alias,self.parent.server.id),
		                                       json.dumps([{"op": "set", "member": "disks", "value": disk_set}]),
											   session=self.session),
							   alias=self.parent.server.alias,
							   session=self.session))
599085
def wipe(self):
        
        try:
            if os.isfile(self._dbpath):
                os.remove(self._dbpath)
        except OSError:
            pass