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):
self.sender = sender
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*args, **kwargs)
......@@ -114,7 +112,7 @@ class ensure_trend:
result =*args, **kwargs)
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