diff options
author | 2014-02-13 17:17:05 +0000 | |
---|---|---|
committer | 2014-02-13 17:17:05 +0000 | |
commit | 536b15ffb05a20f3681ed72749a3bc09c5386c10 (patch) | |
tree | f51bb863e0764cd5088652f43fde63ac61fbbb81 /gm/rebaseline_server/imagepair.py | |
parent | ed3bb1a3a5deab5b6d465466b85d5c45db561ca5 (diff) |
rebaseline_server: create ImagePairSet-- holds a number of ImagePairs to examine
See https://goto.google.com/ChangingRbsJson and bug 1919 for additional context
BUG=skia:1919
NOTRY=True
R=rmistry@google.com
Author: epoger@google.com
Review URL: https://codereview.chromium.org/139343018
git-svn-id: http://skia.googlecode.com/svn/trunk@13434 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm/rebaseline_server/imagepair.py')
-rw-r--r-- | gm/rebaseline_server/imagepair.py | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/gm/rebaseline_server/imagepair.py b/gm/rebaseline_server/imagepair.py index 1c71bd989c..bba36fa8c4 100644 --- a/gm/rebaseline_server/imagepair.py +++ b/gm/rebaseline_server/imagepair.py @@ -12,18 +12,16 @@ ImagePair class (see class docstring for details) import posixpath # Keys used within ImagePair dictionary representations. -KEY_DIFFERENCE_DATA = 'differenceData' -KEY_EXPECTATIONS_DATA = 'expectationsData' -KEY_EXTRA_COLUMN_VALUES = 'extraColumnValues' -KEY_IMAGE_A_URL = 'imageAUrl' -KEY_IMAGE_B_URL = 'imageBUrl' -KEY_IS_DIFFERENT = 'isDifferent' +KEY__DIFFERENCE_DATA = 'differenceData' +KEY__EXPECTATIONS_DATA = 'expectations' +KEY__EXTRA_COLUMN_VALUES = 'extraColumns' +KEY__IMAGE_A_URL = 'imageAUrl' +KEY__IMAGE_B_URL = 'imageBUrl' +KEY__IS_DIFFERENT = 'isDifferent' class ImagePair(object): - """ - Describes a pair of images, along with optional metadata (pixel difference - metrics, whether to ignore mismatches, etc.) + """Describes a pair of images, pixel difference info, and optional metadata. """ def __init__(self, image_diff_db, @@ -63,21 +61,21 @@ class ImagePair(object): actual_image_locator=imageB_relative_url) def as_dict(self): - """ - Return a dictionary describing this ImagePair, as needed when constructing - the JSON representation. Uses the KEY_* constants as keys. + """Returns a dictionary describing this ImagePair. + + Uses the KEY__* constants as keys. """ asdict = { - KEY_IMAGE_A_URL: self.imageA_relative_url, - KEY_IMAGE_B_URL: self.imageB_relative_url, + KEY__IMAGE_A_URL: self.imageA_relative_url, + KEY__IMAGE_B_URL: self.imageB_relative_url, } if self.expectations_dict: - asdict[KEY_EXPECTATIONS_DATA] = self.expectations_dict + asdict[KEY__EXPECTATIONS_DATA] = self.expectations_dict if self.extra_columns_dict: - asdict[KEY_EXTRA_COLUMN_VALUES] = self.extra_columns_dict + asdict[KEY__EXTRA_COLUMN_VALUES] = self.extra_columns_dict if self.diff_record and (self.diff_record.get_num_pixels_differing() > 0): - asdict[KEY_IS_DIFFERENT] = True - asdict[KEY_DIFFERENCE_DATA] = self.diff_record.as_dict() + asdict[KEY__IS_DIFFERENT] = True + asdict[KEY__DIFFERENCE_DATA] = self.diff_record.as_dict() else: - asdict[KEY_IS_DIFFERENT] = False + asdict[KEY__IS_DIFFERENT] = False return asdict |