

@db.transactional(propagation=db.INDEPENDENT)
def _get_content(self, gcs_file):
    'Aggregate all partial content of the gcs_file.\n\n    Args:\n      gcs_file: an instance of _AE_GCSFileInfo_.\n\n    Returns:\n      (error_msg, content) tuple. error_msg is set if the file is\n      corrupted during upload. Otherwise content is set to the\n      aggregation of all partial contents.\n    '
    content = ''
    previous_end = 0
    error_msg = ''
    for partial in _AE_GCSPartialFile_.all(namespace='').ancestor(gcs_file).order('__key__'):
        start = int(partial.key().name())
        if (not error_msg):
            if (gcs_file < previous_end):
                error_msg = 'File is corrupted due to missing chunks.'
            elif (start > previous_end):
                error_msg = 'File is corrupted due to overlapping chunks'
            previous_end = partial.end
            content += self.blob_storage.OpenBlob(partial.partial_content).read()
            self.blob_storage.DeleteBlob(partial.partial_content)
        partial.delete()
    if error_msg:
        gcs_file.delete()
        content = ''
    return (error_msg, content)

dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/ext/cloudstorage/cloudstorage_stub.py CloudStorageStub._get_content/VarMisuse@87/235 `start`->`gcs_file`