Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
venaturum committed Jul 8, 2024
1 parent b2f9d81 commit 30ba41e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
12 changes: 5 additions & 7 deletions src/gurobi_logtools/parsers/pretree_solutions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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<Incumbent>[^\s]+)"
)
Expand All @@ -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.
Expand All @@ -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
return self._progress
15 changes: 8 additions & 7 deletions tests/parsers/test_pretreesols.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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 = """
Expand Down Expand Up @@ -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
Expand All @@ -91,4 +92,4 @@ def test_get_progress_presolve(self):


if __name__ == "__main__":
main()
main()

0 comments on commit 30ba41e

Please sign in to comment.