Commit b72c9804 authored by Artem Pulkin's avatar Artem Pulkin
Browse files

minimize: fix exceptions

parent 0f7f4e85
Pipeline #87030 failed with stages
in 14 minutes and 21 seconds
......@@ -5,9 +5,7 @@ from functools import partial, wraps
class MinimizerException(Exception):
def __init__(self, message, sender):
super().__init__(message)
self.sender = sender
pass
class OutOfBudget(MinimizerException):
......@@ -80,7 +78,7 @@ class count_calls:
def __call__(self, *args, **kwargs):
if self.out_of_budget:
raise OutOfBudget(f"function call count exceeds {self.budget:d}", self)
raise OutOfBudget(f"function call count exceeds {self.budget:d}")
self.n += 1
return self.fun(*args, **kwargs)
......@@ -114,7 +112,7 @@ class ensure_trend:
result = self.fun(*args, **kwargs)
self.history.append(result)
if not self.criterion(self.history):
raise Unstable(f"function trend not satisfied")
raise Unstable("function trend not satisfied")
return result
def __enter__(self):
......
Supports Markdown
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