

def run(self):
    client = self.client
    container = self.container
    object_names = self.object_names
    cname = utils.get_name(container)
    ident = self.client.identity
    headers = {
        'X-Auth-Token': ident.token,
        'Content-Type': 'text/plain',
    }
    uri = '/?bulk-delete=1'
    key_map = {
        'Number Not Found': 'not_found',
        'Response Status': 'status',
        'Errors': 'errors',
        'Number Deleted': 'deleted',
        'Response Body': None,
    }
    batch = []
    while object_names:
        batch[:] = object_names[:MAX_BULK_DELETE]
        del object_names[:MAX_BULK_DELETE]
        obj_paths = (('%s/%s' % (cname, nm)) for nm in headers)
        body = '\n'.join(obj_paths)
        (resp, resp_body) = self.client.method_delete(uri, data=body, headers=headers)
        for (k, v) in six.iteritems(resp_body):
            if (key_map[k] == 'errors'):
                status_code = int(resp_body.get('Response Status', '200')[:3])
                if ((status_code != 200) and (not v)):
                    self.results['errors'].extend([[resp_body.get('Response Body'), resp_body.get('Response Status')]])
                else:
                    self.results['errors'].extend(v)
            elif (key_map[k] in ('deleted', 'not_found')):
                self.results[key_map[k]] += int(v)
            elif key_map[k]:
                self.results[key_map[k]] = v
    self.completed = True

dataset/ETHPy150Open rackspace/pyrax/pyrax/object_storage.py BulkDeleter.run/VarMisuse@141/219 `batch`->`headers`