#NEWLINE# def insert( self , now , obj , then ) : #NEWLINE# #INDENT# 'Inserts object into timer.\n\n        Args:\n            now (int): Current time in msec\n            obj (object): Object to be inserted\n            then (int): When to return the object strictly after.\n        ' #NEWLINE# then_key = ( int ( ( then / self . bucket_size ) ) + 1 ) #NEWLINE# if self . entries : #NEWLINE# #INDENT# min_key = self . entries [ 0 ] . end_key #NEWLINE# max_key = self . entries [ ( - 1 ) ] . end_key #NEWLINE# if ( then_key <= max_key ) : #NEWLINE# #INDENT# self . entries [ ( max ( min_key , then_key ) - min_key ) ] . queue . append ( obj ) #NEWLINE# return #NEWLINE# #UNINDENT# #UNINDENT# next_key = ( int ( ( now / self . bucket_size ) ) + 1 ) #NEWLINE# if self . entries : #NEWLINE# #INDENT# last_key = self . entries [ ( - 1 ) ] . end_key #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# last_key = next_key #NEWLINE# #UNINDENT# then_key = max ( last_key , then_key ) #NEWLINE# self . entries . extend ( ( _Entry ( key ) for key in xrange ( last_key , ( then_key + 1 ) ) ) ) #NEWLINE# self . entries [ ( - 1 ) ] . queue . append ( obj )