diff --git a/src/minizinc/helpers.py b/src/minizinc/helpers.py index 3c6ce13..1ff2308 100644 --- a/src/minizinc/helpers.py +++ b/src/minizinc/helpers.py @@ -57,8 +57,10 @@ def check_result( return True + class TimeoutError(Exception): """Exception raised for timeout errors (UNKNOWN status) when checking solutions""" + pass @@ -102,7 +104,9 @@ def check_solution( check = instance.solve(time_limit=time_limit) if check.status is minizinc.Status.UNKNOWN: - raise TimeoutError(f"Solution checking failed because the checker exceeded the allotted time limit of {time_limit}") + raise TimeoutError( + f"Solution checking failed because the checker exceeded the allotted time limit of {time_limit}" + ) elif status == check.status: return True return check.status in [ diff --git a/src/minizinc/instance.py b/src/minizinc/instance.py index ea4dd11..5a148c7 100644 --- a/src/minizinc/instance.py +++ b/src/minizinc/instance.py @@ -288,7 +288,10 @@ async def solutions( """ # rewrite deprecated option `timeout` if timeout is not None and time_limit is None: - warnings.warn("The usage of the `timeout` parameter is deprecated, please use the `time_limit` parameter instead.", DeprecationWarning) + warnings.warn( + "The usage of the `timeout` parameter is deprecated, please use the `time_limit` parameter instead.", + DeprecationWarning, + ) time_limit = timeout method = self.method # Ensure self.analyse() has been executed @@ -693,7 +696,10 @@ def flat( """ # rewrite deprecated option `timeout` if timeout is not None and time_limit is None: - warnings.warn("The usage of the `timeout` parameter is deprecated, please use the `time_limit` parameter instead.", DeprecationWarning) + warnings.warn( + "The usage of the `timeout` parameter is deprecated, please use the `time_limit` parameter instead.", + DeprecationWarning, + ) time_limit = timeout cmd: List[Any] = ["--compile", "--statistics"]