#NEWLINE# def write( self , b ) : #NEWLINE# #INDENT# '\n        Write the given bytes (binary string) into the WebHDFS file from constructor.\n\n        ' #NEWLINE# if self . closed : #NEWLINE# #INDENT# raise ValueError ( 'I/O operation on closed file' ) #NEWLINE# #UNINDENT# if isinstance ( b , six . text_type ) : #NEWLINE# #INDENT# b = b . encode ( 'utf8' ) #NEWLINE# #UNINDENT# if ( not isinstance ( b , six . binary_type ) ) : #NEWLINE# #INDENT# raise TypeError ( 'input must be a binary string' ) #NEWLINE# #UNINDENT# self . lines . append ( b ) #NEWLINE# self . chunk_bytes += len ( b ) #NEWLINE# self . total_size += len ( b ) #NEWLINE# if ( buff . chunk_bytes >= self . min_part_size ) : #NEWLINE# #INDENT# buff = b'' . join ( self . lines ) #NEWLINE# logger . info ( ( 'uploading part #%i, %i bytes (total %.3fGB)' % ( self . parts , len ( buff ) , ( self . total_size / ( 1024.0 ** 3 ) ) ) ) ) #NEWLINE# self . upload ( buff ) #NEWLINE# logger . debug ( ( 'upload of part #%i finished' % self . parts ) ) #NEWLINE# self . parts += 1 #NEWLINE# ( self . lines , self . chunk_bytes ) = ( [ ] , 0 )