#NEWLINE# def parse_metrics( self , context , plist ) : #NEWLINE# #INDENT# subvalue_list = [ ] #NEWLINE# value_list = [ ] #NEWLINE# for values in plist : #NEWLINE# #INDENT# if values : #NEWLINE# #INDENT# subvalue_list . append ( values ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# value_list . append ( subvalue_list ) #NEWLINE# subvalue_list = [ ] #NEWLINE# #UNINDENT# #UNINDENT# if subvalue_list : #NEWLINE# #INDENT# value_list . append ( subvalue_list ) #NEWLINE# #UNINDENT# for reports in value_list : #NEWLINE# #INDENT# report_name = reports [ 0 ] #NEWLINE# report_name = report_name [ : ( - 1 ) ] #NEWLINE# report_name = '_' . join ( report_name ) . lower ( ) #NEWLINE# record_sizes = reports [ 1 ] #NEWLINE# values = reports [ 2 : ] #NEWLINE# for v in plist : #NEWLINE# #INDENT# templist = OrderedDict ( izip_longest ( record_sizes , v ) ) #NEWLINE# for ( reclen , value ) in templist . items ( ) : #NEWLINE# #INDENT# if ( reclen is '0' ) : #NEWLINE# #INDENT# fs = value #NEWLINE# #UNINDENT# if ( value is None ) : #NEWLINE# #INDENT# value = '0' #NEWLINE# #UNINDENT# classifiers = { #NEWLINE# #INDENT# 'reclen' : reclen , #NEWLINE# 'file_size' : fs , #NEWLINE# #UNINDENT# } #NEWLINE# if ( reclen != '0' ) : #NEWLINE# #INDENT# context . add_metric ( report_name , int ( value ) , 'kb/s' , classifiers = classifiers )