

@db.non_transactional
def put_copy(self, src, dst, options):
    "Copy file from src to dst.\n\n    Metadata is copied.\n\n    Args:\n      src: /bucket/filename. This file must exist.\n      dst: /bucket/filename.\n      options: a dict containing all user specified request headers.\n        e.g. {'content-type': 'foo', 'x-goog-meta-bar': 'bar'}. If None,\n        old metadata is copied.\n    "
    common.validate_file_path(src)
    common.validate_file_path(dst)
    ns = namespace_manager.get_namespace()
    try:
        namespace_manager.set_namespace('')
        src_blobkey = self._filename_to_blobkey(src)
        source = _AE_GCSFileInfo_.get_by_key_name(src_blobkey)
        token = self._filename_to_blobkey(dst)
        new_file = _AE_GCSFileInfo_(key_name=token, filename=dst, finalized=True)
        if options:
            new_file.options = options
        else:
            new_file.options = source.options
        new_file.etag = source.etag
        new_file.size = source.size
        new_file.creation = source.creation
        new_file.put()
    finally:
        namespace_manager.set_namespace(ns)
    if (src_blobkey != token):
        local_file = self.blob_storage.OpenBlob(src_blobkey)
        self.blob_storage.StoreBlob(token, local_file)

dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/ext/cloudstorage/cloudstorage_stub.py CloudStorageStub.put_copy/original