Commit cc98c2aa authored by Brice Videau's avatar Brice Videau

Using local variables.

parent 01498aaf
...@@ -42,9 +42,7 @@ class TestTuner(unittest.TestCase): ...@@ -42,9 +42,7 @@ class TestTuner(unittest.TestCase):
self.assertTrue(all(objs[i][1] >= objs[i+1][1] for i in range(len(objs)-1))) self.assertTrue(all(objs[i][1] >= objs[i+1][1] for i in range(len(objs)-1)))
def test_user_defined(self): def test_user_defined(self):
global history
history = [] history = []
global optimums
optimums = [] optimums = []
def delete(data): def delete(data):
...@@ -58,8 +56,8 @@ class TestTuner(unittest.TestCase): ...@@ -58,8 +56,8 @@ class TestTuner(unittest.TestCase):
return (cs.samples(count), count) return (cs.samples(count), count)
def tell(data, evaluations): def tell(data, evaluations):
global history nonlocal history
global optimums nonlocal optimums
history += evaluations history += evaluations
for e in evaluations: for e in evaluations:
discard = False discard = False
...@@ -80,11 +78,9 @@ class TestTuner(unittest.TestCase): ...@@ -80,11 +78,9 @@ class TestTuner(unittest.TestCase):
return None return None
def get_history(data): def get_history(data):
global history
return history return history
def get_optimums(data): def get_optimums(data):
global optimums
return optimums return optimums
(cs, os) = self.create_tuning_problem() (cs, os) = self.create_tuning_problem()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment