| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 """ | 3 """ |
| 4 Copyright 2014 Google Inc. | 4 Copyright 2014 Google Inc. |
| 5 | 5 |
| 6 Use of this source code is governed by a BSD-style license that can be | 6 Use of this source code is governed by a BSD-style license that can be |
| 7 found in the LICENSE file. | 7 found in the LICENSE file. |
| 8 | 8 |
| 9 ImagePairSet class; see its docstring below. | 9 ImagePairSet class; see its docstring below. |
| 10 """ | 10 """ |
| 11 | 11 |
| 12 # System-level imports | 12 # System-level imports |
| 13 import posixpath | 13 import posixpath |
| 14 | 14 |
| 15 # Local imports | 15 # Local imports |
| 16 import column | 16 import column |
| 17 | 17 |
| 18 # Keys used within dictionary representation of ImagePairSet. | 18 # Keys used within dictionary representation of ImagePairSet. |
| 19 # NOTE: Keep these in sync with static/constants.js | 19 # NOTE: Keep these in sync with static/constants.js |
| 20 KEY__EXTRACOLUMNHEADERS = 'extraColumnHeaders' | |
| 21 KEY__IMAGEPAIRS = 'imagePairs' | 20 KEY__IMAGEPAIRS = 'imagePairs' |
| 22 KEY__IMAGESETS = 'imageSets' | 21 KEY__IMAGESETS = 'imageSets' |
| 23 KEY__IMAGESETS__FIELD__BASE_URL = 'baseUrl' | 22 KEY__IMAGESETS__FIELD__BASE_URL = 'baseUrl' |
| 24 KEY__IMAGESETS__FIELD__DESCRIPTION = 'description' | 23 KEY__IMAGESETS__FIELD__DESCRIPTION = 'description' |
| 25 KEY__IMAGESETS__SET__DIFFS = 'diffs' | 24 KEY__IMAGESETS__SET__DIFFS = 'diffs' |
| 26 KEY__IMAGESETS__SET__IMAGE_A = 'imageA' | 25 KEY__IMAGESETS__SET__IMAGE_A = 'imageA' |
| 27 KEY__IMAGESETS__SET__IMAGE_B = 'imageB' | 26 KEY__IMAGESETS__SET__IMAGE_B = 'imageB' |
| 28 KEY__IMAGESETS__SET__WHITEDIFFS = 'whiteDiffs' | 27 KEY__IMAGESETS__SET__WHITEDIFFS = 'whiteDiffs' |
| 29 | 28 |
| 30 DEFAULT_DESCRIPTIONS = ('setA', 'setB') | 29 DEFAULT_DESCRIPTIONS = ('setA', 'setB') |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 return asdict | 133 return asdict |
| 135 | 134 |
| 136 def as_dict(self): | 135 def as_dict(self): |
| 137 """Returns a dictionary describing this package of ImagePairs. | 136 """Returns a dictionary describing this package of ImagePairs. |
| 138 | 137 |
| 139 Uses the KEY__* constants as keys. | 138 Uses the KEY__* constants as keys. |
| 140 """ | 139 """ |
| 141 key_description = KEY__IMAGESETS__FIELD__DESCRIPTION | 140 key_description = KEY__IMAGESETS__FIELD__DESCRIPTION |
| 142 key_base_url = KEY__IMAGESETS__FIELD__BASE_URL | 141 key_base_url = KEY__IMAGESETS__FIELD__BASE_URL |
| 143 return { | 142 return { |
| 144 KEY__EXTRACOLUMNHEADERS: self._column_headers_as_dict(), | 143 column.KEY__EXTRACOLUMNHEADERS: self._column_headers_as_dict(), |
| 145 KEY__IMAGEPAIRS: self._image_pair_dicts, | 144 KEY__IMAGEPAIRS: self._image_pair_dicts, |
| 146 KEY__IMAGESETS: { | 145 KEY__IMAGESETS: { |
| 147 KEY__IMAGESETS__SET__IMAGE_A: { | 146 KEY__IMAGESETS__SET__IMAGE_A: { |
| 148 key_description: self._descriptions[0], | 147 key_description: self._descriptions[0], |
| 149 key_base_url: self._image_base_url, | 148 key_base_url: self._image_base_url, |
| 150 }, | 149 }, |
| 151 KEY__IMAGESETS__SET__IMAGE_B: { | 150 KEY__IMAGESETS__SET__IMAGE_B: { |
| 152 key_description: self._descriptions[1], | 151 key_description: self._descriptions[1], |
| 153 key_base_url: self._image_base_url, | 152 key_base_url: self._image_base_url, |
| 154 }, | 153 }, |
| 155 KEY__IMAGESETS__SET__DIFFS: { | 154 KEY__IMAGESETS__SET__DIFFS: { |
| 156 key_description: 'color difference per channel', | 155 key_description: 'color difference per channel', |
| 157 key_base_url: posixpath.join( | 156 key_base_url: posixpath.join( |
| 158 self._diff_base_url, 'diffs'), | 157 self._diff_base_url, 'diffs'), |
| 159 }, | 158 }, |
| 160 KEY__IMAGESETS__SET__WHITEDIFFS: { | 159 KEY__IMAGESETS__SET__WHITEDIFFS: { |
| 161 key_description: 'differing pixels in white', | 160 key_description: 'differing pixels in white', |
| 162 key_base_url: posixpath.join( | 161 key_base_url: posixpath.join( |
| 163 self._diff_base_url, 'whitediffs'), | 162 self._diff_base_url, 'whitediffs'), |
| 164 }, | 163 }, |
| 165 }, | 164 }, |
| 166 } | 165 } |
| OLD | NEW |