Skip to content

Commit

Permalink
Reformat with black
Browse files Browse the repository at this point in the history
  • Loading branch information
staadecker committed May 23, 2024
1 parent 9882786 commit f03266f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/pyoframe/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ def process(cls, status: str) -> "SolverStatus":
def from_termination_condition(
cls, termination_condition: "TerminationCondition"
) -> "SolverStatus":
for status, termination_conditions in STATUS_TO_TERMINATION_CONDITION_MAP.items():
for (
status,
termination_conditions,
) in STATUS_TO_TERMINATION_CONDITION_MAP.items():
if termination_condition in termination_conditions:
return status
return cls("unknown")
Expand Down
12 changes: 9 additions & 3 deletions src/pyoframe/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,9 @@ def value(self) -> pl.DataFrame:
>>> m.objective.value
63.0
"""
assert self._model is not None, "Expression must be added to the model to use .value"
assert (
self._model is not None
), "Expression must be added to the model to use .value"
if self._model.result is None or self._model.result.solution is None:
raise ValueError(
"Can't obtain value of expression since the model has not been solved."
Expand Down Expand Up @@ -925,7 +927,9 @@ def slack(self):
The first call to this property will load the slack values from the solver (lazy loading).
"""
if SLACK_COL not in self.data.columns:
assert self._model is not None, "Constraint must be added to a model to get the slack."
assert (
self._model is not None
), "Constraint must be added to a model to get the slack."
if self._model.solver is None:
raise ValueError("The model has not been solved yet.")
self._model.solver.load_slack()
Expand Down Expand Up @@ -1224,7 +1228,9 @@ def RC(self):
The first call to this property will load the reduced costs from the solver (lazy loading).
"""
if RC_COL not in self.data.columns:
assert self._model is not None, "Variable must be added to a model to get the reduced cost."
assert (
self._model is not None
), "Variable must be added to a model to get the reduced cost."
if self._model.solver is None:
raise ValueError("The model has not been solved yet.")
self._model.solver.load_rc()
Expand Down
4 changes: 2 additions & 2 deletions src/pyoframe/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Model(AttrContainerMixin):
"result",
"attr",
"sense",
"objective"
"objective",
]

def __init__(self, min_or_max: Union[ObjSense, ObjSenseValue], name=None, **kwargs):
Expand Down Expand Up @@ -75,7 +75,7 @@ def constraints(self):
@property
def objective(self):
return self._objective

@objective.setter
def objective(self, value):
value = Objective(value)
Expand Down

0 comments on commit f03266f

Please sign in to comment.