#NEWLINE# def received( message ) : #NEWLINE# #INDENT# analytics [ 'queued' ] -= 1 #NEWLINE# analytics [ 'received' ] += 1 #NEWLINE# current_trip = trips [ 'current' ] = str ( datetime . datetime . now ( ) ) [ 0 : 19 ] #NEWLINE# last_trip = trips [ 'last' ] = str ( ( datetime . datetime . now ( ) - datetime . timedelta ( seconds = 1 ) ) ) [ 0 : 19 ] #NEWLINE# if ( current_trip not in trips ) : #NEWLINE# #INDENT# trips [ current_trip ] = 0 #NEWLINE# if ( last_trip in trips ) : #NEWLINE# #INDENT# trips [ 'avg' ] = ( ( trips [ 'avg' ] + trips [ last_trip ] ) / 2 ) #NEWLINE# #UNINDENT# #UNINDENT# trips [ message ] = ( trips [ current_trip ] + 1 ) #NEWLINE# if ( trips [ current_trip ] > trips [ 'max' ] ) : #NEWLINE# #INDENT# trips [ 'max' ] = trips [ current_trip ]