aboutsummaryrefslogtreecommitdiff
path: root/crosperf/generate_report.py
diff options
context:
space:
mode:
Diffstat (limited to 'crosperf/generate_report.py')
-rwxr-xr-xcrosperf/generate_report.py28
1 files changed, 3 insertions, 25 deletions
diff --git a/crosperf/generate_report.py b/crosperf/generate_report.py
index cea95a2e..bae365dc 100755
--- a/crosperf/generate_report.py
+++ b/crosperf/generate_report.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2016 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
@@ -104,7 +104,7 @@ def CutResultsInPlace(results, max_keys=50, complain_on_update=True):
}
"""
actually_updated = False
- for bench_results in results.itervalues():
+ for bench_results in results.values():
for platform_results in bench_results:
for i, result in enumerate(platform_results):
# Keep the keys that come earliest when sorted alphabetically.
@@ -127,26 +127,6 @@ def CutResultsInPlace(results, max_keys=50, complain_on_update=True):
return results
-def _ConvertToASCII(obj):
- """Convert an object loaded from JSON to ASCII; JSON gives us unicode."""
-
- # In python 3, we can directly return the unicode loaded from json.
- if sys.version_info.major == 3:
- return obj
- # TODO(zhizhouy): Drop the following code once migrated to python 3.
- # Using something like `object_hook` is insufficient, since it only fires on
- # actual JSON objects. `encoding` fails, too, since the default decoder always
- # uses unicode() to decode strings.
- # pylint: disable=unicode-builtin
- if isinstance(obj, unicode):
- return str(obj)
- if isinstance(obj, dict):
- return {_ConvertToASCII(k): _ConvertToASCII(v) for k, v in obj.iteritems()}
- if isinstance(obj, list):
- return [_ConvertToASCII(v) for v in obj]
- return obj
-
-
def _PositiveInt(s):
i = int(s)
if i < 0:
@@ -279,10 +259,8 @@ def _ParseArgs(argv):
def Main(argv):
args = _ParseArgs(argv)
- # JSON likes to load UTF-8; our results reporter *really* doesn't like
- # UTF-8.
with PickInputFile(args.input) as in_file:
- raw_results = _ConvertToASCII(json.load(in_file))
+ raw_results = json.load(in_file)
platform_names = raw_results['platforms']
results = raw_results['data']