From a7d56f81f61fd31f4fc63e0d55dfd4fdbba034fc Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 24 Nov 2024 15:56:56 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20pre-commit=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mqt/qao/karp/karp_number.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mqt/qao/karp/karp_number.py b/src/mqt/qao/karp/karp_number.py index 5a8229d..eebbcc8 100644 --- a/src/mqt/qao/karp/karp_number.py +++ b/src/mqt/qao/karp/karp_number.py @@ -154,11 +154,11 @@ def sat( txt_outputname = "SAT: " - if isinstance(problem, Problem): solution = solver_method(problem) else: - raise TypeError("Expected `problem` to be of type `Problem`.") + msg = "Expected `problem` to be of type `Problem`." + raise TypeError(msg) if solution is None or not hasattr(solution, "best_solution"): msg = "Solver did not return a valid solution." @@ -248,8 +248,9 @@ def three_sat( clauses = [[str(item[0]), str(item[1])] for item in input_data] filename = "" else: - raise ValueError("Invalid input_data type. Expected str or list[tuple[int, int]].") - + msg = "Invalid input_data type. Expected str or list[tuple[int, int]]." + raise ValueError(msg) + graph = KarpNumber._create_graph(clauses) problem = KarpGraphs.independent_set(graph, solve=False) @@ -268,7 +269,8 @@ def three_sat( if isinstance(problem, Problem): solution = solver_method(problem) else: - raise TypeError("Expected `problem` to be of type `Problem`.") + msg = "Expected `problem` to be of type `Problem`." + raise TypeError(msg) if solution is None or not hasattr(solution, "best_solution"): msg = "Solver did not return a valid solution." @@ -313,9 +315,7 @@ def three_sat( return output_dict @staticmethod - def check_three_sat_solution( - clauses: Any, solution: dict[str, float] - ) -> dict[Any, Any]: + def check_three_sat_solution(clauses: Any, solution: dict[str, float]) -> dict[Any, Any]: """Validates a solution for the 3-SAT problem by checking clause satisfaction.""" not_satisfied_clauses = []