aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTing-Yuan Huang <laszio@google.com>2016-08-02 14:02:02 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-08-02 15:21:07 -0700
commit2e307b303ac37c3e971086f23da2df25fef2c1b4 (patch)
tree3ec018b7ce6f02576aeebd430cf7ba616245d09f
parent711a224060336a4e1dcade76233312f08dec811b (diff)
downloadtoolchain-utils-2e307b303ac37c3e971086f23da2df25fef2c1b4.tar.gz
crosperf: fix lint warnings
BUG=chromium:632098 TEST=cros lint [files] Change-Id: Ieac300bf7cb3b560fd8caaaacc3714696ca5567f Reviewed-on: https://chrome-internal-review.googlesource.com/272616 Commit-Ready: Ting-Yuan Huang <laszio@google.com> Tested-by: Ting-Yuan Huang <laszio@google.com> Reviewed-by: Caroline Tice <cmtice@google.com>
-rw-r--r--crosperf/download_images.py9
-rw-r--r--crosperf/machine_image_manager.py17
-rwxr-xr-xcrosperf/results_organizer_unittest.py14
3 files changed, 27 insertions, 13 deletions
diff --git a/crosperf/download_images.py b/crosperf/download_images.py
index 1b971892..da0b4e37 100644
--- a/crosperf/download_images.py
+++ b/crosperf/download_images.py
@@ -1,7 +1,11 @@
-# Copyright (c) 2014, 2015 The Chromium OS Authors. All rights reserved.
+# Copyright (c) 2014-2015 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+"""Download images from Cloud Storage."""
+
+from __future__ import print_function
+
import ast
import os
@@ -15,6 +19,7 @@ class MissingImage(Exception):
class ImageDownloader(object):
+ """Download images from Cloud Storage."""
def __init__(self, logger_to_use=None, log_level='verbose', cmd_exec=None):
self._logger = logger_to_use
@@ -28,7 +33,7 @@ class ImageDownloader(object):
# image name.
command = ('cd ~/trunk/src/third_party/toolchain-utils/crosperf; '
"python translate_xbuddy.py '%s'" % xbuddy_label)
- retval, build_id_tuple_str, _ = self._ce.ChrootRunCommandWOutput(
+ _, build_id_tuple_str, _ = self._ce.ChrootRunCommandWOutput(
chromeos_root, command)
if not build_id_tuple_str:
raise MissingImage("Unable to find image for '%s'" % xbuddy_label)
diff --git a/crosperf/machine_image_manager.py b/crosperf/machine_image_manager.py
index 3b96140e..3cc464bb 100644
--- a/crosperf/machine_image_manager.py
+++ b/crosperf/machine_image_manager.py
@@ -1,6 +1,9 @@
-# Copyright 2015 Google Inc. All Rights Reserved.
+# Copyright 2015 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+"""MachineImageManager allocates images to duts."""
class MachineImageManager(object):
"""Management of allocating images to duts.
@@ -143,7 +146,7 @@ class MachineImageManager(object):
# Generate initial matrix containg 'X' or ' '.
self.matrix_ = [['X' if (l.remote and len(l.remote)) else ' ' \
- for d in range(self.n_duts_)] for l in self.labels_]
+ for _ in range(self.n_duts_)] for l in self.labels_]
for ol, l in enumerate(self.labels_):
if l.remote:
for r in l.remote:
@@ -193,7 +196,7 @@ class MachineImageManager(object):
def allocate(self, dut, schedv2=None):
"""Allocate a label for dut.
- Arguments:
+ Args:
dut: the dut that asks for a new image.
schedv2: the scheduling instance, we need the benchmark run
information with schedv2 for a better allocation.
@@ -215,7 +218,7 @@ class MachineImageManager(object):
# Note schedv2 might be None in case we do not need this
# optimization or we are in testing mode.
if schedv2 is not None:
- pending_br_num = len(schedv2._label_brl_map[label])
+ pending_br_num = len(schedv2.get_label_map()[label])
if pending_br_num == 0:
# (A) - we have finished all br of this label,
# apparently, we do not want to reimaeg dut to
@@ -269,7 +272,7 @@ class MachineImageManager(object):
Yield row number i and value at matrix_[i][col].
"""
- for i, l in enumerate(self.labels_):
+ for i, _ in enumerate(self.labels_):
yield i, self.matrix_[i][col]
def matrix_horizontal_generator(self, row):
@@ -277,11 +280,11 @@ class MachineImageManager(object):
Yield col number j and value at matrix_[row][j].
"""
- for j, d in enumerate(self.duts_):
+ for j, _ in enumerate(self.duts_):
yield j, self.matrix_[row][j]
def _compute_initial_allocation_internal(self, level, N):
- """ Search matrix for d with N. """
+ """Search matrix for d with N."""
if level == self.n_labels_:
return True
diff --git a/crosperf/results_organizer_unittest.py b/crosperf/results_organizer_unittest.py
index 914ecc5e..74d5c23a 100755
--- a/crosperf/results_organizer_unittest.py
+++ b/crosperf/results_organizer_unittest.py
@@ -1,11 +1,16 @@
-#!/usr/bin/python
+#!/usr/bin/python2
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-"""Testing of ResultsOrganizer. We create some labels, benchmark_runs
- and then create a ResultsOrganizer, after that, we compare the result of
- ResultOrganizer"""
+
+"""Testing of ResultsOrganizer
+
+ We create some labels, benchmark_runs and then create a ResultsOrganizer,
+ after that, we compare the result of ResultOrganizer.
+ """
+
+from __future__ import print_function
import unittest
@@ -67,6 +72,7 @@ result = {'benchmark1': [[{'': 'PASS',
class ResultOrganizerTest(unittest.TestCase):
+ """Test result organizer."""
def testResultOrganizer(self):
labels = [mock_instance.label1, mock_instance.label2]