aboutsummaryrefslogtreecommitdiff
path: root/binary_search_tool
diff options
context:
space:
mode:
authorYunlian Jiang <yunlian@google.com>2015-12-16 14:12:22 -0800
committerchrome-bot <chrome-bot@chromium.org>2015-12-17 02:03:23 +0000
commit633ab684d64f68b03e8aa49f4bf9ef4193840275 (patch)
tree9775c7ce0fdf496d27d82fb65e8a1192cf575095 /binary_search_tool
parentb860c4b6d6bda8bda32bcbf27adf3d8118c81ed7 (diff)
downloadtoolchain-utils-633ab684d64f68b03e8aa49f4bf9ef4193840275.tar.gz
toolchain-utils: clean lint warning.
BUG=chromium:567921 TEST=binary_search_state.py is lint clean. Change-Id: Ie5f3b056e64167ac715b1cb03cc796aa4f3f33be Reviewed-on: https://chrome-internal-review.googlesource.com/242515 Commit-Ready: Yunlian Jiang <yunlian@google.com> Tested-by: Yunlian Jiang <yunlian@google.com> Reviewed-by: Caroline Tice <cmtice@google.com> Reviewed-by: Yunlian Jiang <yunlian@google.com>
Diffstat (limited to 'binary_search_tool')
-rwxr-xr-xbinary_search_tool/binary_search_state.py25
1 files changed, 10 insertions, 15 deletions
diff --git a/binary_search_tool/binary_search_state.py b/binary_search_tool/binary_search_state.py
index 274f2c6b..c103cb3c 100755
--- a/binary_search_tool/binary_search_state.py
+++ b/binary_search_tool/binary_search_state.py
@@ -1,4 +1,8 @@
-#!/usr/bin/python
+#!/usr/bin/python2
+
+"""The binary search wrapper."""
+
+from __future__ import print_function
import optparse
import os
@@ -25,7 +29,7 @@ STATE_FILE = '%s.state' % sys.argv[0]
class BinarySearchState(object):
-
+ """The binary search state class."""
def __init__(self, get_initial_items, switch_to_good, switch_to_bad,
test_script, incremental, prune, iterations, prune_iterations,
verify_level, file_args):
@@ -44,6 +48,7 @@ class BinarySearchState(object):
self.ce = command_executer.GetCommandExecuter()
self.bs = None
+ self.all_items = None
self.PopulateItemsUsingCommand(self.get_initial_items)
self.currently_good_items = set([])
self.currently_bad_items = set([])
@@ -163,7 +168,7 @@ class BinarySearchState(object):
terminated = False
while i < self.iterations and not terminated:
i += 1
- [bad_items, good_items] = self.GetNextItems(self.incremental)
+ [bad_items, good_items] = self.GetNextItems()
# TODO: bad_items should come first.
self.SwitchToGood(good_items)
@@ -204,17 +209,7 @@ class BinarySearchState(object):
return None
return pickle.load(file(STATE_FILE))
- @classmethod
- def GetInstance(cls, command):
- # Disable state loading for now.
- # obj = cls.LoadState()
- obj = None
- if not obj:
- obj = cls()
- return obj
- return obj
-
- def GetNextItems(self, incremental=True):
+ def GetNextItems(self):
border_item = self.bs.GetNext()
index = self.all_items.index(border_item)
@@ -327,7 +322,7 @@ def Main(argv):
bss.DoSearch()
except (KeyboardInterrupt, SystemExit):
- print 'C-c pressed'
+ print('C-c pressed')
bss.SaveState()
return 0