Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
alma-walmsley committed Dec 22, 2024
1 parent f8d64a2 commit a0e3556
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion property_packages/modular/modular_extended.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from pyomo.core.base.expression import ScalarExpression
from pyomo.core.base.var import ScalarVar, _GeneralVarData, VarData
from idaes.core import declare_process_block_class
from idaes.core.util.exceptions import ConfigurationError
from idaes.models.properties.modular_properties.base.generic_property import (
_GenericStateBlock,
GenericParameterData,
Expand Down Expand Up @@ -136,7 +137,9 @@ def constrain(self, name: str, value: float):
# Value must be a float. TODO: Handle unit conversion.
var = getattr(self, name)
if type(var) == ScalarExpression:
self.constraints.add_component(name, Constraint(expr=var == value))
c = Constraint(expr=var == value)
c.abcdef = True
self.constraints.add_component(name, c)
elif type(var) in (ScalarVar, _GeneralVarData, VarData):
var.fix(value)
else:
Expand Down
2 changes: 1 addition & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
def report_vars(blk, file):
with open(file, "w") as f:
for c in blk.component_data_objects(Var, descend_into=True, active=True):
f.write(f"{c}: {c.value} {"fixed" if c.fixed else "unfixed"}\n")
f.write(f"{c}: {c.value} {'fixed' if c.fixed else 'unfixed'}\n")
# with open("file8.txt", "r") as f:
# with open(f"{file}_diff", "w") as f2:
# for c in blk.component_data_objects(Var, descend_into=True):
Expand Down

0 comments on commit a0e3556

Please sign in to comment.