#NEWLINE# def _updateDisplay( self , modulo = 1 ) : #NEWLINE# #INDENT# self . displayCounter += 1 #NEWLINE# if ( ( self . displayCounter % modulo ) != 0 ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# fileName = self . _getFileNameDisplayString ( ) #NEWLINE# if ( self . fileSize is None ) : #NEWLINE# #INDENT# displayString = '{}   bytes received: {}\r' #NEWLINE# bytesReceived = humanize . filesize . naturalsize ( self . bytesReceived ) #NEWLINE# self . stream . write ( displayString . format ( fileName , bytesReceived ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# percentage = min ( ( self . bytesReceived / self . fileSize ) , 1 ) #NEWLINE# numerator = humanize . filesize . naturalsize ( min ( self . bytesReceived , self . fileSize ) ) #NEWLINE# denominator = humanize . filesize . naturalsize ( self . fileSize ) #NEWLINE# displayString = '{}   {:<6.2%} ({:>9} / {:<9})\r' #NEWLINE# self . stream . write ( displayString . format ( fileName , percentage , numerator , denominator ) ) #NEWLINE# #UNINDENT# self . stream . flush ( )