#NEWLINE# def _flush( self ) : #NEWLINE# #INDENT# items_to_send = self . _items_buffer [ : self . _flush_amount ] #NEWLINE# self . _items_buffer = self . _items_buffer [ self . _flush_amount : ] #NEWLINE# response = self . _client . batch_write_item ( RequestItems = { #NEWLINE# #INDENT# self . _table_name : items_to_send , #NEWLINE# #UNINDENT# } ) #NEWLINE# unprocessed_items = response [ 'UnprocessedItems' ] #NEWLINE# if ( unprocessed_items and unprocessed_items [ items_to_send . _table_name ] ) : #NEWLINE# #INDENT# self . _items_buffer . extend ( unprocessed_items [ self . _table_name ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _items_buffer = [ ] #NEWLINE# #UNINDENT# logger . debug ( 'Batch write sent %s, unprocessed: %s' , len ( items_to_send ) , len ( self . _items_buffer ) )