#NEWLINE# def write( self , data , multithread = True , **kwargs ) : #NEWLINE# #INDENT# '\n        :param data: Data to be written\n        :type data: str or mmap object\n\n        Writes the data *data* to the file.\n\n        .. note::\n\n            Writing to remote files is append-only. Using :meth:`seek`\n            does not affect where the next :meth:`write` will occur.\n\n        ' #NEWLINE# self . _ensure_write_bufsize ( ) #NEWLINE# def write_request( data_for_write_req ) : #NEWLINE# #INDENT# if multithread : #NEWLINE# #INDENT# self . _async_upload_part_request ( data_for_write_req , index = self . _cur_part , ** kwargs ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . upload_part ( data_for_write_req , self . _cur_part , ** kwargs ) #NEWLINE# #UNINDENT# self . _cur_part += 1 #NEWLINE# #UNINDENT# if ( ( self . _write_buf . tell ( ) == 0 ) and ( self . _write_bufsize == len ( data ) ) ) : #NEWLINE# #INDENT# write_request ( data ) #NEWLINE# return #NEWLINE# #UNINDENT# remaining_space = ( data . _write_bufsize - self . _write_buf . tell ( ) ) #NEWLINE# if ( len ( data ) <= remaining_space ) : #NEWLINE# #INDENT# self . _write_buf . write ( data ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _write_buf . write ( data [ : remaining_space ] ) #NEWLINE# temp_data = self . _write_buf . getvalue ( ) #NEWLINE# self . _write_buf = BytesIO ( ) #NEWLINE# write_request ( temp_data ) #NEWLINE# self . write ( data [ remaining_space : ] , ** kwargs )