Delete one or more buckets or objects.
495003
def _storage_delete(args, _):
  
  items = _expand_list(args['bucket'])
  items.extend(_expand_list(args['object']))
  errs = []
  for item in items:
    try:
      bucket, key = datalab.storage._bucket.parse_name(item)
      if bucket and key:
        gcs_item = datalab.storage.Item(bucket, key)
        if gcs_item.exists():
          datalab.storage.Item(bucket, key).delete()
        else:
          errs.append("%s does not exist" % item)
      elif bucket:
        gcs_bucket = datalab.storage.Bucket(bucket)
        if gcs_bucket.exists():
          gcs_bucket.delete()
        else:
          errs.append("%s does not exist" % item)
      else:
        raise Exception("Can't delete item with invalid name %s" % item)
    except Exception as e:
      errs.append("Couldn't delete %s: %s" %
                  (item, _extract_storage_api_response_error(str(e))))
  if errs:
    raise Exception('\n'.join(errs))
416864
def delete_bucket():
    
    args = parser.parse_args
    s3_bucket(args.aws_access_key_id, args.aws_secret_access_key, args.bucket_name)().delete()
979420
def delete_many(cls, documents):
        """"""

        # Ensure all documents have been converted to frames
        frames = cls._ensure_frames(documents)

        all_count = len(documents)
        assert len([f for f in frames if '_id' in f._document]) == all_count, \
                "Can't delete documents without `_id`s"

        # Send delete signal
        signal('delete').send(cls, frames=frames)

        # Prepare the documents to be deleted
        ids = [f._id for f in frames]

        # Delete the documents
        cls.get_collection().delete_many({'_id': {'$in': ids}})

        # Send deleted signal
        signal('deleted').send(cls, frames=frames)
712310
def delete_vector(self, hash_name, bucket_keys, data):
        
        for key in bucket_keys:
            bucket = self.get_bucket(hash_name, key)
            bucket[:] = [(v, id_data) for v, id_data
                         in bucket if id_data != data]
1283065
def delete(self, **kwargs):
        """"""
        self.inflate()
        for model in self._models:
            model.delete(**kwargs)
        return
242475
def delete_object(self, bucket, object_name):
        
        details = self._details(
            method=b"DELETE",
            url_context=self._url_context(bucket=bucket, object_name=object_name),
        )
        d = self._submit(self._query_factory(details))
        return d
1067646
def delete(self, skip_mapping=False):
        """"""
        for index in self.indexes:
            index.destroy()
            if not skip_mapping:
                index.create_mapping()
273486
def delete(self, bucket=None, ignore=False):
        

        # Make lists
        buckets = bucket
        if isinstance(bucket, six.string_types):
            buckets = [bucket]
        elif bucket is None:
            buckets = reversed(self.buckets)

        # Iterate over buckets
        for bucket in buckets:

            # Non existent bucket
            if bucket not in self.buckets:
                if not ignore:
                    message = 'Bucket "%s" doesn\'t exist' % bucket
                    raise tableschema.exceptions.StorageError(message)
                return

            # Remove from descriptors
            if bucket in self.__descriptors:
                del self.__descriptors[bucket]

            # Remove from dataframes
            if bucket in self.__dataframes:
                del self.__dataframes[bucket]
1212182
def cleanup_storage(*args):
    """"""
    ShardedClusters().cleanup()
    ReplicaSets().cleanup()
    Servers().cleanup()
    sys.exit(0)
1296546
function(bucket, callback) {
    var s3 = new AWS.S3({maxRetries: 100});
    s3.deleteBucket({Bucket: bucket}, function(err, data) {
      callback(err);
    });
  }
608424
def remove_bucket(self, instance, bucket_name):
        
        url = '/buckets/{}/{}'.format(instance, bucket_name)
        self._client.delete_proto(url)
577094
def batch_delete_s3_objects(
        keys,
        aws_bucket_name,
        chunk_size=100,
        s3_client=None
):
    
    if s3_client is None:
        s3_client, s3_resource = get_s3_client()

    key_chunks = []
    for i in range(0, len(keys), chunk_size):
        chunk = []
        for key in (list(keys)[i:i+100]):
            chunk.append({'Key': key})
        key_chunks.append(chunk)
    for chunk in key_chunks:
        s3_client.delete_objects(
            Bucket=aws_bucket_name,
            Delete={'Objects': chunk}
        )
360694
def delete_objects(objects, request_options = {})
      check_array(objects)
      batch(build_batch('deleteObject', objects.map { |objectID| { :objectID => objectID } }, false), request_options)
    end
22039
def delete(self, bucket=None, ignore=False):
        

        # Make lists
        buckets = bucket
        if isinstance(bucket, six.string_types):
            buckets = [bucket]
        elif bucket is None:
            buckets = reversed(self.buckets)

        # Iterate
        tables = []
        for bucket in buckets:

            # Check existent
            if bucket not in self.buckets:
                if not ignore:
                    message = 'Bucket "%s" doesn\'t exist.' % bucket
                    raise tableschema.exceptions.StorageError(message)
                return

            # Remove from buckets
            if bucket in self.__descriptors:
                del self.__descriptors[bucket]

            # Add table to tables
            table = self.__get_table(bucket)
            tables.append(table)

        # Drop tables, update metadata
        self.__metadata.drop_all(tables=tables)
        self.__metadata.clear()
        self.__reflect()
1123722
def flush(self):
    """"""
    self.puts.flush()
    self.deletes.flush()
    self.ndb_puts.flush()
    self.ndb_deletes.flush()
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)
1268256
def clean(self):
        
        for key, value in self.values.copy().items():
            if value is None:
                del self.values[key]