#NEWLINE# def __call__( self , size ) : #NEWLINE# #INDENT# if ( not self . speed_limit ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# if ( self . prev_time is None ) : #NEWLINE# #INDENT# self . prev_time = time . time ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# sleep_time = ( float ( self . sent_size ) / self . speed_limit ) #NEWLINE# sleep_time -= ( time . time ( ) - self . prev_time ) #NEWLINE# if ( sleep_time > 0 ) : #NEWLINE# #INDENT# time . sleep ( sleep_time ) #NEWLINE# self . sent_size = 0 #NEWLINE# self . prev_time = time . time ( ) #NEWLINE# #UNINDENT# #UNINDENT# self . sent_size += size