#NEWLINE# def get_stats( self , host , port ) : #NEWLINE# #INDENT# ignored = ( 'time' , 'version' ) #NEWLINE# stats = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# queues = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# data = self . get_raw_stats ( host , port ) #NEWLINE# for line in data . splitlines ( ) : #NEWLINE# #INDENT# pieces = line . split ( ' ' ) #NEWLINE# if ( ( pieces [ 0 ] != 'STAT' ) or ( pieces [ 1 ] in ignored ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if re . match ( '^queue' , pieces [ 1 ] ) : #NEWLINE# #INDENT# queue_match = re . match ( '^queue_(.*)_(items|waiters|open_transactions)$' , pieces [ 1 ] ) #NEWLINE# queue_name = queue_match . group ( 1 ) . replace ( '.' , '_' ) #NEWLINE# if ( queue_name not in queues ) : #NEWLINE# #INDENT# queues [ queue_name ] = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# queues [ queue_name ] [ queue_match . group ( 2 ) ] = int ( pieces [ 2 ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# stats [ pieces [ 1 ] ] = int ( pieces [ 2 ] ) #NEWLINE# #UNINDENT# #UNINDENT# return ( stats , queues )