From 3eb77e4d5a381fa55197f6bd03c599e709146069 Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Fri, 4 Apr 2014 16:40:25 +0000 Subject: teach rebaseline_server how to compare results of multiple render_pictures runs BUG=skia:2230,skia:1942 NOTRY=True R=rmistry@google.com Author: epoger@google.com Review URL: https://codereview.chromium.org/216103004 git-svn-id: http://skia.googlecode.com/svn/trunk@14062 2bbb7eff-a529-9590-31e7-b0007b416f81 --- gm/rebaseline_server/results.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'gm/rebaseline_server/results.py') diff --git a/gm/rebaseline_server/results.py b/gm/rebaseline_server/results.py index 7cf57453ca..49e32519a7 100755 --- a/gm/rebaseline_server/results.py +++ b/gm/rebaseline_server/results.py @@ -197,3 +197,33 @@ class BaseComparisons(object): test_name=test_name, hash_type=hashtype_and_digest[0], hash_digest=hashtype_and_digest[1]) + + @staticmethod + def combine_subdicts(input_dict): + """ Flatten out a dictionary structure by one level. + + Input: + { + "failed" : { + "changed.png" : [ "bitmap-64bitMD5", 8891695120562235492 ], + }, + "no-comparison" : { + "unchanged.png" : [ "bitmap-64bitMD5", 11092453015575919668 ], + } + } + + Output: + { + "changed.png" : [ "bitmap-64bitMD5", 8891695120562235492 ], + "unchanged.png" : [ "bitmap-64bitMD5", 11092453015575919668 ], + } + + If this would result in any repeated keys, it will raise an Exception. + """ + output_dict = {} + for key, subdict in input_dict.iteritems(): + for subdict_key, subdict_value in subdict.iteritems(): + if subdict_key in output_dict: + raise Exception('duplicate key %s in combine_subdicts' % subdict_key) + output_dict[subdict_key] = subdict_value + return output_dict -- cgit v1.2.3