Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Unified Diff: gm/rebaseline_server/results.py

Issue 216103004: teach rebaseline_server how to compare results of multiple render_pictures runs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: ravi comments Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: gm/rebaseline_server/results.py
diff --git a/gm/rebaseline_server/results.py b/gm/rebaseline_server/results.py
index 7cf57453ca64307ef69cfd69e92c870bb7988f72..49e32519a707eab54114ed432bcb04f99a049321 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

Powered by Google App Engine
This is Rietveld 408576698