@@ -172,7 +172,7 @@ def _add_enforced_linear_constraint_to_helper(
172172 helper .set_enforced_constraint_lower_bound (c .index , bounded_expr .lower_bound )
173173 helper .set_enforced_constraint_upper_bound (c .index , bounded_expr .upper_bound )
174174 if name is not None :
175- helper .set_constraint_name (c .index , name )
175+ helper .set_enforced_constraint_name (c .index , name )
176176 return c
177177
178178 raise TypeError (f"invalid type={ type (bounded_expr ).__name__ !r} " )
@@ -720,7 +720,7 @@ def new_var_series(
720720 if (
721721 mbn .is_a_number (lower_bounds )
722722 and mbn .is_a_number (upper_bounds )
723- and lower_bounds > upper_bounds
723+ and lower_bounds > upper_bounds # pyrefly: ignore[unsupported-operation]
724724 ):
725725 raise ValueError (
726726 f"lower_bound={ lower_bounds } is greater than"
@@ -941,16 +941,24 @@ def add_enforced_linear_constraint( # pytype: disable=annotation-type-mismatch
941941 ct .indicator_variable = ivar
942942 ct .indicator_value = ivalue
943943 if name :
944- self .__helper .set_constraint_name (ct .index , name )
944+ self .__helper .set_enforced_constraint_name (ct .index , name )
945945 if mbn .is_a_number (linear_expr ):
946- self .__helper .set_constraint_lower_bound (ct .index , lb - linear_expr )
947- self .__helper .set_constraint_upper_bound (ct .index , ub - linear_expr )
946+ self .__helper .set_enforced_constraint_lower_bound (
947+ ct .index , lb - linear_expr
948+ )
949+ self .__helper .set_enforced_constraint_upper_bound (
950+ ct .index , ub - linear_expr
951+ )
948952 elif isinstance (linear_expr , LinearExpr ):
949953 flat_expr = mbh .FlatExpr (linear_expr )
950954 # pylint: disable=protected-access
951- self .__helper .set_constraint_lower_bound (ct .index , lb - flat_expr .offset )
952- self .__helper .set_constraint_upper_bound (ct .index , ub - flat_expr .offset )
953- self .__helper .add_terms_to_constraint (
955+ self .__helper .set_enforced_constraint_lower_bound (
956+ ct .index , lb - flat_expr .offset
957+ )
958+ self .__helper .set_enforced_constraint_upper_bound (
959+ ct .index , ub - flat_expr .offset
960+ )
961+ self .__helper .add_terms_to_enforced_constraint (
954962 ct .index , flat_expr .vars , flat_expr .coeffs
955963 )
956964 else :
@@ -992,7 +1000,11 @@ def add_enforced(
9921000 """
9931001 if isinstance (ct , mbh .BoundedLinearExpression ):
9941002 return _add_enforced_linear_constraint_to_helper (
995- ct , self .__helper , var , value , name
1003+ ct ,
1004+ self .__helper ,
1005+ var ,
1006+ value ,
1007+ name , # pyrefly: ignore[bad-argument-type]
9961008 )
9971009 elif (
9981010 isinstance (ct , bool )
@@ -1233,7 +1245,7 @@ def value(self, expr: LinearExprT) -> np.double:
12331245 if not self .__solve_helper .has_solution ():
12341246 return pd .NA
12351247 if mbn .is_a_number (expr ):
1236- return expr
1248+ return expr # pyrefly: ignore[bad-return]
12371249 elif isinstance (expr , LinearExpr ):
12381250 return self .__solve_helper .expression_value (expr )
12391251 else :
0 commit comments