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

Unified Diff: tools/metrics/histograms/extract_histograms.py

Issue 2822783002: [Cleanup] Clean up enum ordering code in extract_histograms.py (Closed)
Patch Set: Whitespace Created 3 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/metrics/histograms/extract_histograms.py
diff --git a/tools/metrics/histograms/extract_histograms.py b/tools/metrics/histograms/extract_histograms.py
index 61d7e864d6e1fbe4a4652de484c2302f51640e75..8e4a13daf8f4cb6fa9a83b28c7f3cd8cb3435915 100644
--- a/tools/metrics/histograms/extract_histograms.py
+++ b/tools/metrics/histograms/extract_histograms.py
@@ -216,8 +216,7 @@ def _ExtractEnumsFromXmlTree(tree):
value_dict['summary'] = _JoinChildNodes(int_tag)
enum_dict['values'][int_value] = value_dict
- enum_items = sorted(enum_dict['values'].iteritems(), key=lambda i: i[0])
- enum_int_values = list(i[0] for i in enum_items)
+ enum_int_values = sorted(enum_dict['values'].keys())
last_int_value = None
for int_tag in enum.getElementsByTagName('int'):
@@ -230,9 +229,10 @@ def _ExtractEnumsFromXmlTree(tree):
if left_item_index == 0:
logging.warning('Insert value %d at the beginning', int_value)
else:
- left_int_value, left_value_dict = enum_items[left_item_index - 1]
+ left_int_value = enum_int_values[left_item_index - 1]
+ left_label = enum_dict['values'][left_int_value]
logging.warning('Insert value %d after %d ("%s")',
- int_value, left_int_value, left_value_dict['label'])
+ int_value, left_int_value, left_label)
DmitrySkiba 2017/04/14 22:01:41 Previously it was logging just a string, but now l
Ilya Sherman 2017/04/14 22:31:26 Whoops, not intentional, thanks. Fixed.
else:
last_int_value = int_value
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698