Try to delete the batch, throw errors if config, or formatting prevents deletion
340736
function (options, deleteBatch, callbacky) {
  var numberDocsToDelete = 0
  if (!Array.isArray(deleteBatch)) {
    deleteBatch = [deleteBatch]
  }
  a.series([
    function(callback) {
      if (!options.deletable) {
        options.indexes.get('DF￮*￮*￮￮', function (err, keys) {
          // are any of the deletebatch in the index?
          var keysInIndex = _intersection(deleteBatch, keys)
          var docExistsErr = null
          if (keysInIndex.length > 0) {
            docExistsErr = new Error(
              'this index is non-deleteable, and some of the documents you are deleting have IDs that are already present in the index. Either reinitialize index with "deletable: true" or alter the IDs of the new documents')
            return callbacky(docExistsErr)
          } else {
            return callback(null, null)
          }
        })
      } else {
        return callback(null, null)
      }
    },
    function(callback) {
      a.mapLimit(deleteBatch, 5, function (docID, mapCallback) {
        options.indexes.get('DELETE-DOCUMENT￮' + docID, function (err, keys) {
          if (err) {
            if (err.name === 'NotFoundError') {
              return mapCallback(null, [])
            }
          } else {
            numberDocsToDelete++
          }
          return mapCallback(err, keys)
        })
      }, function (err, results) {
        if (err) {
          return callbacky(err)
        } else {
          deleteThisBatch(options, numberDocsToDelete, deleteBatch, results, function (err) {
            return callbacky(err)
          })
        }
      })
    }
  ])

}
224971
def _remove_batches(self, block, keep_batches):
        
        clone = Block()
        clone.header = block.header
        clone.header_signature = block.header_signature
        clone.batches.extend([
            batch for batch in block.batches
            if batch.header_signature in keep_batches
        ])
        return clone
447447
def removeAll(self):
        
        before_len = len(self.model.db)
        self.model.db = []
        if not self._batch.enable.is_set():
            self.model.save_db()
        return before_len - len(self.model.db)
1354280
def delete(collection_name, spec, safe,
           last_error_args, opts, flags=0):
    
    data = _ZERO_32
    data += bson._make_c_string(collection_name)
    data += struct.pack("<I", flags)
    encoded = bson.BSON.encode(spec, False, opts)
    data += encoded
    if safe:
        (_, remove_message) = __pack_message(2006, data)
        (request_id, error_message, _) = __last_error(collection_name,
                                                      last_error_args)
        return (request_id, remove_message + error_message, len(encoded))
    else:
        (request_id, remove_message) = __pack_message(2006, data)
        return (request_id, remove_message, len(encoded))
989371
@SafeVarargs
    public static <T extends Model, S extends Serializable> void deleteBatch(Class<T> model, S... ids) {
        atomic(() -> Arrays.stream(ids)
                .forEach(new AnimaQuery<>(model)::deleteById))
                .catchException(e -> log.error("Batch save model error, message: {}", e));
    }
701046
function (err) {
            try {
                safeDeleteTempFile();
                doneFn(me.reorderFiles(
                    files
                ));
            } catch (e) {
                grunt.log.error(e);
                safeDeleteTempFile();
            }
        }
910147
def handle_error(ex, file_name)
      if ex.message == "NOSCRIPT No matching script. Please use EVAL."
        SCRIPT_SHAS.delete(file_name)
        return yield if block_given?
      end

      raise ScriptError, file_name: file_name, source_exception: ex
    end
504952
private function commitBatch() {

        //Check if there are any operations and commit the batch
        if(count($this->batch->getOperations()))
        {
            $this->client->commitBatch();
        }

        //There are no operations, just end the batch
        else
        {
            $this->client->endBatch();
        }

        //Delete the batch
        $this->batch = null;

    }
360393
private JsonBatchCallback<Void> getDeletionCallback(
      final StorageResourceId resourceId,
      final KeySetView<IOException, Boolean> innerExceptions,
      final BatchHelper batchHelper,
      final int attempt,
      final long generation) {
    return new JsonBatchCallback<Void>() {
      @Override
      public void onSuccess(Void obj, HttpHeaders responseHeaders) {
        logger.atFine().log("Successfully deleted %s at generation %s", resourceId, generation);
      }

      @Override
      public void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) throws IOException {
        if (errorExtractor.itemNotFound(e)) {
          // Ignore item-not-found errors. We do not have to delete what we cannot find. This
          // error typically shows up when we make a request to delete something and the server
          // receives the request but we get a retry-able error before we get a response.
          // During a retry, we no longer find the item because the server had deleted
          // it already.
          logger.atFine().log("deleteObjects(%s): delete not found:%n%s", resourceId, e);
        } else if (errorExtractor.preconditionNotMet(e)
            && attempt <= MAXIMUM_PRECONDITION_FAILURES_IN_DELETE) {
          logger.atInfo().log(
              "Precondition not met while deleting %s at generation %s. Attempt %s. Retrying:%n%s",
              resourceId, generation, attempt, e);
          queueSingleObjectDelete(resourceId, innerExceptions, batchHelper, attempt + 1);
        } else {
          innerExceptions.add(
              new IOException(
                  String.format(
                      "Error deleting %s, stage 2 with generation %s:%n%s",
                      resourceId, generation, e)));
        }
      }
    };
  }
506513
def _abort_batches(self):
        """"""
        error = Errors.IllegalStateError("Producer is closed forcefully.")
        for batch in self._incomplete.all():
            tp = batch.topic_partition
            # Close the batch before aborting
            with self._tp_locks[tp]:
                batch.records.close()
            batch.done(exception=error)
            self.deallocate(batch)
1036805
def delete_all(config=None):
    
    storm_ = get_storm_instance(config)

    try:
        storm_.delete_all_entries()
        print(get_formatted_message('all entries deleted.', 'success'))
    except Exception as error:
        print(get_formatted_message(str(error), 'error'), file=sys.stderr)
        sys.exit(1)
1233161
def cleanup(temp_name):
    '''  '''
    for filename in iglob(temp_name + '*' if temp_name else temp_name):
        try:
            os.remove(filename)
        except OSError:
            pass
1128115
def do_remove(config, config_dir):
    
    if not os.path.exists(config_dir):
        print "Configuration '{}' does not exist.".format(config)
        exit(1)
    if confirm("Confirm removal of the configuration '{}'".format(config)):
        shutil.rmtree(config_dir)
        print "Configuration '{}' has been removed.".format(config)
    else:
        print "Removal cancelled."
1014930
function handleMongoWriteConcernError(batch, bulkResult, ordered, err, callback) {
  mergeBatchResults(ordered, batch, bulkResult, null, err.result);

  const wrappedWriteConcernError = new WriteConcernError({
    errmsg: err.result.writeConcernError.errmsg,
    code: err.result.writeConcernError.result
  });
  return handleCallback(
    callback,
    new BulkWriteError(toError(wrappedWriteConcernError), new BulkWriteResult(bulkResult)),
    null
  );
}
1046166
def versionable_delete(self, instance, timestamp):
        
        instance._delete_at(timestamp, using=self.using)
788711
def delete(name, config=None):
    
    storm_ = get_storm_instance(config)

    try:
        storm_.delete_entry(name)
        print(
            get_formatted_message(
                'hostname "{0}" deleted successfully.'.format(name),
            'success')
        )
    except ValueError as error:
        print(get_formatted_message(error, 'error'), file=sys.stderr)
        sys.exit(1)
599085
def wipe(self):
        
        try:
            if os.isfile(self._dbpath):
                os.remove(self._dbpath)
        except OSError:
            pass