Cleanup the benchmarking script.

This patch fixes:
  - whitespace style
  - unused import
  - unused variable

in the benchmarking script.

R=qsr@chromium.org

Review URL: https://codereview.chromium.org/1417553008 .

Cr-Mirrored-From: https://github.com/domokit/mojo
Cr-Mirrored-Commit: a36b420c85c8cdc99bea93700d605017f2ac911b
diff --git a/devtoolslib/perf_dashboard.py b/devtoolslib/perf_dashboard.py
index 235eab4..e4d132d 100644
--- a/devtoolslib/perf_dashboard.py
+++ b/devtoolslib/perf_dashboard.py
@@ -107,7 +107,7 @@
 def _get_commit_count():
   """Returns the number of git commits in the repository of the cwd."""
   return subprocess.check_output(
-      ["git", "rev-list", "HEAD", "--count"]).strip()
+      ['git', 'rev-list', 'HEAD', '--count']).strip()
 
 
 def _get_current_commit():
@@ -144,13 +144,13 @@
     try:
       urllib2.urlopen(req)
     except urllib2.HTTPError as e:
-      raise _UploadException("HTTPError: %d. Response: %s\n"
-                             "JSON: %s\n" % (e.code, e.read(), json_data))
+      raise _UploadException('HTTPError: %d. Response: %s\n'
+                             'JSON: %s\n' % (e.code, e.read(), json_data))
     except urllib2.URLError as e:
-      raise _UploadException("URLError: %s for JSON %s\n" %
+      raise _UploadException('URLError: %s for JSON %s\n' %
                              (str(e.reason), json_data))
     except httplib.HTTPException as e:
-      raise _UploadException("HTTPException for JSON %s\n" % json_data)
+      raise _UploadException('HTTPException for JSON %s\n' % json_data)
 
   if (not master_name or not bot_name or not test_name or not builder_name or
       not build_number):
@@ -164,28 +164,28 @@
 
   # Wrap the |chart_data| with meta data as required by the spec.
   formatted_data = {
-      "master": master_name,
-      "bot": bot_name,
-      "masterid": master_name,
-      "buildername": builder_name,
-      "buildnumber": build_number,
-      "versions": {
-          "mojo": cur_commit,
+      'master': master_name,
+      'bot': bot_name,
+      'masterid': master_name,
+      'buildername': builder_name,
+      'buildnumber': build_number,
+      'versions': {
+          'mojo': cur_commit,
       },
-      "point_id": point_id,
-      "supplemental": {},
-      "chart_data": chart_data,
+      'point_id': point_id,
+      'supplemental': {},
+      'chart_data': chart_data,
   }
 
   upload_url = server_url if server_url else _LOCAL_SERVER
 
   if dry_run:
-    print "Won't upload because --dry-run is specified."
-    print "Server: %s" % upload_url
-    print "Data:"
+    print 'Will not upload because --dry-run is specified.'
+    print 'Server: %s' % upload_url
+    print 'Data:'
     pprint.pprint(formatted_data)
   else:
-    print "Uploading data to %s ..." % upload_url
+    print 'Uploading data to %s ...' % upload_url
     try:
       _upload(upload_url, json.dumps(formatted_data))
     except _UploadException as e:
@@ -195,11 +195,11 @@
     print "Done."
 
     dashboard_params = urllib.urlencode({
-        "masters": master_name,
-        "bots": bot_name,
-        "tests": test_name,
-        "rev": point_id
+        'masters': master_name,
+        'bots': bot_name,
+        'tests': test_name,
+        'rev': point_id
     })
-    print "Results Dashboard: %s/report?%s" % (upload_url, dashboard_params)
+    print 'Results Dashboard: %s/report?%s' % (upload_url, dashboard_params)
 
   return True
diff --git a/mojo_benchmark b/mojo_benchmark
index 249f26b..4a5c6fe 100755
--- a/mojo_benchmark
+++ b/mojo_benchmark
@@ -6,7 +6,6 @@
 """Runner for Mojo application benchmarks."""
 
 import argparse
-import json
 import logging
 import os.path
 import re
@@ -71,8 +70,8 @@
 _NETWORK_SERVICE_URL = 'mojo:network_service'
 
 _COLD_START_SHELL_ARGS = [
-  '--args-for=%s %s' % (_CACHE_SERVICE_URL, '--clear'),
-  '--args-for=%s %s' % (_NETWORK_SERVICE_URL, '--clear'),
+    '--args-for=%s %s' % (_CACHE_SERVICE_URL, '--clear'),
+    '--args-for=%s %s' % (_NETWORK_SERVICE_URL, '--clear'),
 ]
 
 # Additional time in seconds allocated per shell run to accommodate start-up.
@@ -101,22 +100,22 @@
   """
   variants = []
   variants.append({
-    'variant_name': 'cold start',
-    'app': benchmark_spec['app'],
-    'duration': benchmark_spec['duration'],
-    'measurements': benchmark_spec['measurements'],
-    'shell-args': benchmark_spec.get('shell-args',
-                                     []) + _COLD_START_SHELL_ARGS})
+      'variant_name': 'cold start',
+      'app': benchmark_spec['app'],
+      'duration': benchmark_spec['duration'],
+      'measurements': benchmark_spec['measurements'],
+      'shell-args': benchmark_spec.get('shell-args',
+                                       []) + _COLD_START_SHELL_ARGS})
   variants.append({
-    'variant_name': 'warm start',
-    'app': benchmark_spec['app'],
-    'duration': benchmark_spec['duration'],
-    'measurements': benchmark_spec['measurements'],
-    'shell-args': benchmark_spec.get('shell-args', [])})
+      'variant_name': 'warm start',
+      'app': benchmark_spec['app'],
+      'duration': benchmark_spec['duration'],
+      'measurements': benchmark_spec['measurements'],
+      'shell-args': benchmark_spec.get('shell-args', [])})
   return variants
 
 
-def _run_benchmark(shell, shell_args, name, app, duration_seconds, measurements,
+def _run_benchmark(shell, shell_args, app, duration_seconds, measurements,
                    verbose, android, output_file):
   """Runs the given benchmark by running `benchmark.mojo` in mojo shell with
   appropriate arguments and returns the produced output.
@@ -163,6 +162,7 @@
 
   return True, None, output
 
+
 def _parse_measurement_results(output):
   """Parses the measurement results present in the benchmark output and returns
   the dictionary of correctly recognized and parsed results.
@@ -230,8 +230,8 @@
             script_args.test_name)
 
       benchmark_succeeded, benchmark_error, output = _run_benchmark(
-          shell, shell_args, variant_name, app, duration, measurements,
-          script_args.verbose, script_args.android, output_file)
+          shell, shell_args, app, duration, measurements, script_args.verbose,
+          script_args.android, output_file)
 
       print '[ %s ] %s ' % (benchmark_name, variant_name)