#NEWLINE# def _flush( self , auto = True , bookmark = None ) : #NEWLINE# #INDENT# 'Flush complete chunks from the write buffer. An incomplete chunk\n        may be created (and the write buffer completely emptied) if\n        auto=False' #NEWLINE# if ( auto and ( not self . autoflush ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# while ( self . writebuf and ( ( len ( self . writebuf ) >= self . chunksize ) or ( not auto ) ) ) : #NEWLINE# #INDENT# self . chunkidx += 1 #NEWLINE# assert ( self . chunkidx == len ( self . chunks ) ) #NEWLINE# chunkpos = ( self . pos - len ( self . writebuf ) ) #NEWLINE# chunkname = ( '%s%08x' % ( self . prefix , chunkpos ) ) #NEWLINE# chunkbookmark = None #NEWLINE# if ( bookmark and ( len ( self . writebuf ) <= self . chunksize ) ) : #NEWLINE# #INDENT# chunkname += ( ',' + urlsafe_b64encode ( bookmark ) ) #NEWLINE# chunkbookmark = chunkname #NEWLINE# #UNINDENT# self . zip . writestr ( chunkname , self . writebuf [ : self . chunksize ] ) #NEWLINE# self . writebuf = self . writebuf [ self . chunksize : ] #NEWLINE# self . chunks . append ( ChunkInfo ( name = chunkname , pos = chunkpos , bookmark = chunkbookmark ) )