Skip to content

Commit

Permalink
update formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Dekker1 committed Oct 27, 2023
1 parent 1bf1221 commit 96885db
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/minizinc/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ def check_result(

return True


class TimeoutError(Exception):
"""Exception raised for timeout errors (UNKNOWN status) when checking solutions"""

pass


Expand Down Expand Up @@ -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 [
Expand Down
10 changes: 8 additions & 2 deletions src/minizinc/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"]
Expand Down

0 comments on commit 96885db

Please sign in to comment.