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

Unified Diff: gm/rebaseline_server/column.py

Issue 270413002: rebaseline_server JSON: pass category values as values, not keys (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 7 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/column.py
diff --git a/gm/rebaseline_server/column.py b/gm/rebaseline_server/column.py
index d8d119d1304f74b43c35c5e865863f7d1ccef958..eb58b81bc21a0c5a4be0f2cf1aa9ed0dbef5b30a 100644
--- a/gm/rebaseline_server/column.py
+++ b/gm/rebaseline_server/column.py
@@ -9,13 +9,17 @@ found in the LICENSE file.
ColumnHeaderFactory class (see class docstring for details)
"""
+import utils
+
# Keys used within dictionary representation of each column header.
# NOTE: Keep these in sync with static/constants.js
-KEY__HEADER_TEXT = 'headerText'
-KEY__HEADER_URL = 'headerUrl'
-KEY__IS_FILTERABLE = 'isFilterable'
-KEY__IS_SORTABLE = 'isSortable'
-KEY__VALUES_AND_COUNTS = 'valuesAndCounts'
+KEY__EXTRACOLUMNHEADERS = 'extraColumnHeaders'
+KEY__EXTRACOLUMNHEADERS__COUNTS = 'counts'
epoger 2014/05/07 21:26:17 While I was at it, renamed these particular key co
+KEY__EXTRACOLUMNHEADERS__HEADER_TEXT = 'headerText'
+KEY__EXTRACOLUMNHEADERS__HEADER_URL = 'headerUrl'
+KEY__EXTRACOLUMNHEADERS__IS_FILTERABLE = 'isFilterable'
+KEY__EXTRACOLUMNHEADERS__IS_SORTABLE = 'isSortable'
+KEY__EXTRACOLUMNHEADERS__VALUES = 'values'
class ColumnHeaderFactory(object):
@@ -46,7 +50,8 @@ class ColumnHeaderFactory(object):
"""Creates the header for this column, in dictionary form.
Creates the header for this column in dictionary form, as needed when
- constructing the JSON representation. Uses the KEY__* constants as keys.
+ constructing the JSON representation. Uses the KEY__EXTRACOLUMNHEADERS__*
+ constants as keys.
Args:
values_and_counts_dict: dictionary mapping each possible column value
@@ -54,12 +59,14 @@ class ColumnHeaderFactory(object):
None if this information is not available.
"""
asdict = {
- KEY__HEADER_TEXT: self._header_text,
- KEY__IS_FILTERABLE: self._is_filterable,
- KEY__IS_SORTABLE: self._is_sortable,
+ KEY__EXTRACOLUMNHEADERS__HEADER_TEXT: self._header_text,
+ KEY__EXTRACOLUMNHEADERS__IS_FILTERABLE: self._is_filterable,
+ KEY__EXTRACOLUMNHEADERS__IS_SORTABLE: self._is_sortable,
}
if self._header_url:
- asdict[KEY__HEADER_URL] = self._header_url
+ asdict[KEY__EXTRACOLUMNHEADERS__HEADER_URL] = self._header_url
if self._include_values_and_counts and values_and_counts_dict:
- asdict[KEY__VALUES_AND_COUNTS] = values_and_counts_dict
+ values, counts = utils.unzip_dict(values_and_counts_dict)
+ asdict[KEY__EXTRACOLUMNHEADERS__VALUES] = values
+ asdict[KEY__EXTRACOLUMNHEADERS__COUNTS] = counts
return asdict
« no previous file with comments | « no previous file | gm/rebaseline_server/compare_to_expectations.py » ('j') | gm/rebaseline_server/compare_to_expectations.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698