Skip to content

Commit 1405731

Browse files
committed
black
1 parent 1221996 commit 1405731

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

pyomo/gdp/plugins/bigm_mixin.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,8 @@ def _add_constraint_expressions(
254254
M_expr = M[0] * (1 - indicator_var)
255255
newConstraint.add((name, i, 'lb'), c.lower <= c.body - M_expr)
256256
constraint_map.transformed_constraints[c].append(
257-
newConstraint[name, i, 'lb'])
257+
newConstraint[name, i, 'lb']
258+
)
258259
constraint_map.src_constraint[newConstraint[name, i, 'lb']] = c
259260
if c.upper is not None:
260261
if M[1] is None:

pyomo/gdp/plugins/hull.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,8 @@ def _transform_constraint(
752752
newConstraint.add((name, i, 'eq'), newConsExpr)
753753
# map the _ConstraintDatas (we mapped the container above)
754754
constraint_map.transformed_constraints[c].append(
755-
newConstraint[name, i, 'eq'])
755+
newConstraint[name, i, 'eq']
756+
)
756757
constraint_map.src_constraint[newConstraint[name, i, 'eq']] = c
757758
else:
758759
newConstraint.add((name, 'eq'), newConsExpr)

pyomo/gdp/tests/test_bigm.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -1317,8 +1317,7 @@ def test_do_not_transform_deactivated_constraintDatas(self):
13171317

13181318
# the real test: This wasn't transformed
13191319
with self.assertRaisesRegex(
1320-
GDP_Error,
1321-
r"Constraint 'b.simpledisj1.c\[1\]' has not been transformed."
1320+
GDP_Error, r"Constraint 'b.simpledisj1.c\[1\]' has not been transformed."
13221321
):
13231322
bigm.get_transformed_constraints(m.b.simpledisj1.c[1])
13241323

@@ -2267,8 +2266,7 @@ def check_all_but_evil1_b_anotherblock_constraint_transformed(self, m):
22672266
self.assertIs(evil1[1].parent_block(), disjBlock[1])
22682267
with self.assertRaisesRegex(
22692268
GDP_Error,
2270-
r"Constraint 'evil\[1\].b.anotherblock.c' has not been "
2271-
r"transformed.",
2269+
r"Constraint 'evil\[1\].b.anotherblock.c' has not been transformed.",
22722270
):
22732271
bigm.get_transformed_constraints(m.evil[1].b.anotherblock.c)
22742272

pyomo/gdp/tests/test_hull.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -898,8 +898,7 @@ def test_do_not_transform_deactivated_constraintDatas(self):
898898
hull.apply_to(m)
899899
# can't ask for simpledisj1.c[1]: it wasn't transformed
900900
with self.assertRaisesRegex(
901-
GDP_Error,
902-
r"Constraint 'b.simpledisj1.c\[1\]' has not been transformed."
901+
GDP_Error, r"Constraint 'b.simpledisj1.c\[1\]' has not been transformed."
903902
):
904903
hull.get_transformed_constraints(m.b.simpledisj1.c[1])
905904

pyomo/gdp/util.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -539,12 +539,14 @@ def get_transformed_constraints(srcConstraint):
539539
)
540540
transBlock = _get_constraint_transBlock(srcConstraint)
541541
transformed_constraints = transBlock.private_data(
542-
'pyomo.gdp').transformed_constraints
542+
'pyomo.gdp'
543+
).transformed_constraints
543544
if srcConstraint in transformed_constraints:
544545
return transformed_constraints[srcConstraint]
545546
else:
546-
raise GDP_Error("Constraint '%s' has not been transformed." %
547-
srcConstraint.name)
547+
raise GDP_Error(
548+
"Constraint '%s' has not been transformed." % srcConstraint.name
549+
)
548550

549551

550552
def _warn_for_active_disjunct(innerdisjunct, outerdisjunct):

0 commit comments

Comments
 (0)