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

Unified Diff: gm/rebaseline_server/results.py

Issue 424263005: teach rebaseline_server to generate diffs of rendered SKPs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Ravi comments Created 6 years, 4 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
« no previous file with comments | « gm/rebaseline_server/imagepairset.py ('k') | gm/rebaseline_server/server.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/rebaseline_server/results.py
diff --git a/gm/rebaseline_server/results.py b/gm/rebaseline_server/results.py
index da970af3c7ba333fe05db7be8c775f015dd2b666..347666a3b5760bb64cfc8a469b61ac386fa80626 100755
--- a/gm/rebaseline_server/results.py
+++ b/gm/rebaseline_server/results.py
@@ -303,11 +303,22 @@ class BaseComparisons(object):
return output_dict
@staticmethod
- def get_multilevel(input_dict, *keys):
- """ Returns input_dict[key1][key2][...], or None if any key is not found.
+ def get_default(input_dict, default_value, *keys):
+ """Returns input_dict[key1][key2][...], or default_value.
+
+ If input_dict is None, or any key is missing along the way, this returns
+ default_value.
+
+ Args:
+ input_dict: dictionary to look within
+ key: key indicating which value to return from input_dict
+ default_value: value to return if input_dict is None or any key cannot
+ be found along the way
"""
+ if input_dict == None:
+ return default_value
for key in keys:
- if input_dict == None:
- return None
input_dict = input_dict.get(key, None)
+ if input_dict == None:
+ return default_value
return input_dict
« no previous file with comments | « gm/rebaseline_server/imagepairset.py ('k') | gm/rebaseline_server/server.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698