From 30ba41ef22290e5356b3290d414311ed2b75835d Mon Sep 17 00:00:00 2001 From: venaturum Date: Mon, 8 Jul 2024 23:07:44 +1000 Subject: [PATCH] linting --- src/gurobi_logtools/parsers/pretree_solutions.py | 12 +++++------- tests/parsers/test_pretreesols.py | 15 ++++++++------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/gurobi_logtools/parsers/pretree_solutions.py b/src/gurobi_logtools/parsers/pretree_solutions.py index 046e614..34a5a7b 100644 --- a/src/gurobi_logtools/parsers/pretree_solutions.py +++ b/src/gurobi_logtools/parsers/pretree_solutions.py @@ -2,8 +2,8 @@ from gurobi_logtools.parsers.util import typeconvert_groupdict -class PretreeSolutionParser: +class PretreeSolutionParser: pretree_solution_regex = re.compile( r"Found heuristic solution:\sobjective\s(?P[^\s]+)" ) @@ -17,7 +17,7 @@ def __init__(self): """ self._progress = [] self._summary = {} - #self._started = False + # self._started = False def parse(self, line: str) -> bool: """Parse the given log line to populate summary data. @@ -36,10 +36,8 @@ def parse(self, line: str) -> bool: def get_summary(self) -> dict: """Return the current parsed summary.""" - return { - "PreTreeSolutions": len(self._progress) - } - + return {"PreTreeSolutions": len(self._progress)} + def get_progress(self) -> list: """Return the progress of the search tree.""" - return self._progress \ No newline at end of file + return self._progress diff --git a/tests/parsers/test_pretreesols.py b/tests/parsers/test_pretreesols.py index 2fc415e..1b8c781 100644 --- a/tests/parsers/test_pretreesols.py +++ b/tests/parsers/test_pretreesols.py @@ -1,7 +1,7 @@ from unittest import TestCase, main -from gurobi_logtools.parsers.presolve import PresolveParser from gurobi_logtools.parsers.continuous import ContinuousParser +from gurobi_logtools.parsers.presolve import PresolveParser from gurobi_logtools.parsers.pretree_solutions import PretreeSolutionParser from gurobi_logtools.parsers.util import parse_lines @@ -25,10 +25,10 @@ expected_summary = {"PreTreeSolutions": 3} -expected_progress = [ - {'Incumbent': 1133356000.0}, - {'Incumbent': 2133356000.0}, - {'Incumbent': 3133356000.0}, +expected_progress = [ + {"Incumbent": 1133356000.0}, + {"Incumbent": 2133356000.0}, + {"Incumbent": 3133356000.0}, ] example_log_1 = """ @@ -63,9 +63,10 @@ Optimal objective 2.174035714e+02 """ -example_logs = (example_log_0,example_log_1) +example_logs = (example_log_0, example_log_1) parsers = (PresolveParser, ContinuousParser) + class TestPresolve(TestCase): def setUp(self): pass @@ -91,4 +92,4 @@ def test_get_progress_presolve(self): if __name__ == "__main__": - main() \ No newline at end of file + main()