#NEWLINE# def convert_ts_list( self , ts_list , time_slice = None ) : #NEWLINE# #INDENT# "Process lists from timeseries sorted sets.\n\n        Args:\n            ts_list: List of tuples from the ts_ sorted set.\n            time_slice: Optional. Name of a key in TIME_SLICES. The value of\n                that key sets the size of the bucket the time series data\n                is sorted into. Defaults to minute buckets.\n\n\n        Takes a list of scores and values from a time series sorted set and\n        return a list of entries in the form ({TIMESTAMP}, {COUNT}). This is\n        required because the TS sorted set doesn't hold the raw count, to make\n        the values unique it stores them as '{TIMESTAMP}:{COUNT}'\n\n        " #NEWLINE# ret = [ ] #NEWLINE# slice_dict = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if ( time_slice is None ) : #NEWLINE# #INDENT# time_slice = 'minute' #NEWLINE# #UNINDENT# time_slice = TIME_SLICES [ time_slice ] #NEWLINE# if ( not ts_list ) : #NEWLINE# #INDENT# return [ ] #NEWLINE# #UNINDENT# for ts_entry in ts_list : #NEWLINE# #INDENT# ts = int ( ts_entry [ 1 ] ) #NEWLINE# count = int ( ts_entry [ 0 ] . split ( ':' ) [ 1 ] ) #NEWLINE# key = ( ts / time_slice ) #NEWLINE# slice_dict [ key ] = ( slice_dict . get ( key , 0 ) + count ) #NEWLINE# #UNINDENT# keys = slice_dict . keys ( ) #NEWLINE# keys . sort ( ) #NEWLINE# for i in range ( keys [ 0 ] , keys [ ( - 1 ) ] ) : #NEWLINE# #INDENT# if ( i not in slice_dict ) : #NEWLINE# #INDENT# slice_dict [ i ] = 0 #NEWLINE# #UNINDENT# #UNINDENT# keys = slice_dict . keys ( ) #NEWLINE# keys . sort ( ) #NEWLINE# for key in keys : #NEWLINE# #INDENT# ret . append ( TSTuple ( ( key * time_slice ) , slice_dict [ key ] ) ) #NEWLINE# #UNINDENT# return ret