#NEWLINE# def avg_css_stats( stats_list ) : #NEWLINE# #INDENT# '\n  Returns averaged CSS stats from a list of the CSS stats of multiple runs. We return the average CSS totalTime and the\n  max of the most time consuming and most misses rules from all the runs.\n  ' #NEWLINE# css_result = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# css_result [ '_totalTime' ] = ( sum ( ( stats [ '_totalTime' ] for stats in stats_list ) ) / len ( stats_list ) ) #NEWLINE# css_result [ '_mostTimeConsumingRule' ] = max ( ( stats [ '_mostTimeConsumingRule' ] for stats in stats_list ) , key = ( lambda rule : rule [ 'time' ] ) ) #NEWLINE# css_result [ '_mostMissesRule' ] = max ( ( stats [ '_mostMissesRule' ] for stats in stats_list ) , key = ( lambda rule : ( rule [ 'hitCount' ] - rule [ 'matchCount' ] ) ) ) #NEWLINE# return css_result