#NEWLINE# def tick( self ) : #NEWLINE# #INDENT# 'Decay the current rate according to the elapsed time' #NEWLINE# instant_rate = ( float ( self . value ) / float ( self . tick_interval ) ) #NEWLINE# with self . lock : #NEWLINE# #INDENT# if self . initialized : #NEWLINE# #INDENT# self . rate += ( self . alpha * ( instant_rate - self . rate ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . initialized = True #NEWLINE# self . rate = instant_rate #NEWLINE# #UNINDENT# self . value = 0