

def _upload(self, obj_name, content, content_type, content_encoding, content_length, etag, chunked, chunk_size, headers):
    '\n        Handles the uploading of content, including working around the 5GB\n        maximum file size.\n        '
    if (content_type is not None):
        headers['Content-Type'] = content_type
    if (content_encoding is not None):
        headers['Content-Encoding'] = content_encoding
    if isinstance(content, six.string_types):
        fsize = len(content)
    elif chunked:
        fsize = None
    elif (content_length is None):
        fsize = get_file_size(content)
    else:
        fsize = content_length
    if (fsize <= MAX_FILE_SIZE):
        return self._store_object(obj_name, content=content, etag=etag, chunked=chunked, chunk_size=chunk_size, headers=headers)
    num_segments = int(math.ceil((float(fsize) / MAX_FILE_SIZE)))
    digits = (int(math.log10(num_segments)) + 1)
    for segment in range(num_segments):
        sequence = str((segment + 1)).zfill(digits)
        seg_name = ('%s.%s' % (obj_name, sequence))
        with utils.SelfDeletingTempfile() as tmpname:
            with open(tmpname, 'wb') as tmp:
                tmp.write(content.read(MAX_FILE_SIZE))
            with open(tmpname, 'rb') as tmp:
                etag = utils.get_checksum(chunked)
                self._store_object(seg_name, content=tmp, etag=etag, chunked=False, headers=headers)
    headers.pop('ETag', '')
    headers['X-Object-Manifest'] = ('%s/%s.' % (self.name, obj_name))
    self._store_object(obj_name, content=None, headers=headers)

dataset/ETHPy150Open rackspace/pyrax/pyrax/object_storage.py StorageObjectManager._upload/VarMisuse@287/418 `tmp`->`chunked`