parameters: (self, file_name, object_name, use_file=False, file_start=0,
               file_size=None)
docstring: Performs an upload to the test bucket.
  
      The file is uploaded to the bucket referred to by self.bucket_url, and has
      name object_name.
  
      Args:
        file_name: The path to the local file, and the key to its entry in
                   temp_file_dict.
        object_name: The name of the remote object.
        use_file: If true, use disk I/O, otherwise read everything from memory.
        file_start: The first byte in the file to upload to the object.
                    (only should be specified for sliced uploads)
        file_size: The size of the file to upload.
                   (only should be specified for sliced uploads)
  
      Returns:
        Uploaded Object Metadata.
docstring_summary: Performs an upload to the test bucket.
docstring_tokens: Performs an upload to the test bucket .
function: def Upload(self, file_name, object_name, use_file=False, file_start=0,
               file_size=None):
      """Performs an upload to the test bucket.
  
      The file is uploaded to the bucket referred to by self.bucket_url, and has
      name object_name.
  
      Args:
        file_name: The path to the local file, and the key to its entry in
                   temp_file_dict.
        object_name: The name of the remote object.
        use_file: If true, use disk I/O, otherwise read everything from memory.
        file_start: The first byte in the file to upload to the object.
                    (only should be specified for sliced uploads)
        file_size: The size of the file to upload.
                   (only should be specified for sliced uploads)
  
      Returns:
        Uploaded Object Metadata.
      """
      fp = None
      if file_size is None:
        file_size = temp_file_dict[file_name].size
  
      upload_url = self.bucket_url.Clone()
      upload_url.object_name = object_name
      upload_target = StorageUrlToUploadObjectMetadata(upload_url)
  
      try:
        if use_file:
          fp = FilePart(file_name, file_start, file_size)
        else:
          data = temp_file_dict[file_name].data[file_start:file_start+file_size]
          fp = cStringIO.StringIO(data)
  
        def _InnerUpload():
          if file_size < ResumableThreshold():
            return self.gsutil_api.UploadObject(
                fp, upload_target, provider=self.provider, size=file_size,
                fields=['name', 'mediaLink', 'size'])
          else:
            return self.gsutil_api.UploadObjectResumable(
                fp, upload_target, provider=self.provider, size=file_size,
                fields=['name', 'mediaLink', 'size'],
                tracker_callback=_DummyTrackerCallback)
        return self._RunOperation(_InnerUpload)
      finally:
        if fp:
          fp.close()
function_tokens: def Upload ( self , file_name , object_name , use_file = False , file_start = 0 , file_size = None ) : fp = None if file_size is None : file_size = temp_file_dict [ file_name ] . size upload_url = self . bucket_url . Clone ( ) upload_url . object_name = object_name upload_target = StorageUrlToUploadObjectMetadata ( upload_url ) try : if use_file : fp = FilePart ( file_name , file_start , file_size ) else : data = temp_file_dict [ file_name ] . data [ file_start : file_start + file_size ] fp = cStringIO . StringIO ( data ) def _InnerUpload ( ) : if file_size < ResumableThreshold ( ) : return self . gsutil_api . UploadObject ( fp , upload_target , provider = self . provider , size = file_size , fields = [ 'name' , 'mediaLink' , 'size' ] ) else : return self . gsutil_api . UploadObjectResumable ( fp , upload_target , provider = self . provider , size = file_size , fields = [ 'name' , 'mediaLink' , 'size' ] , tracker_callback = _DummyTrackerCallback ) return self . _RunOperation ( _InnerUpload ) finally : if fp : fp . close ( )