Skip to content

Commit 1e3665f

Browse files
committed
Correct condition
1 parent 4053f21 commit 1e3665f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/pyscipopt/matrix.pxi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@ class MatrixExpr(np.ndarray):
2727
return res if res.size > 1 else res.item()
2828

2929
def __le__(self, other: Union[float, int, Expr, np.ndarray, 'MatrixExpr']) -> MatrixExprCons:
30-
if not _is_number(other) or not isinstance(other, (Expr, MatrixExpr, np.ndarray)):
30+
if not (_is_number(other) or isinstance(other, (Expr, MatrixExpr, np.ndarray))):
3131
raise TypeError(f"Unsupported type {type(other)}")
3232

3333
return super().__le__(other).view(MatrixExprCons)
3434

3535
def __ge__(self, other: Union[float, int, Expr, np.ndarray, 'MatrixExpr']) -> MatrixExprCons:
36-
if not _is_number(other) or not isinstance(other, (Expr, MatrixExpr, np.ndarray)):
36+
if not (_is_number(other) or isinstance(other, (Expr, MatrixExpr, np.ndarray))):
3737
raise TypeError(f"Unsupported type {type(other)}")
3838

3939
return super().__ge__(other).view(MatrixExprCons)
4040

4141
def __eq__(self, other: Union[float, int, Expr, np.ndarray, 'MatrixExpr']) -> MatrixExprCons:
42-
if not _is_number(other) or not isinstance(other, (Expr, MatrixExpr, np.ndarray)):
42+
if not (_is_number(other) or isinstance(other, (Expr, MatrixExpr, np.ndarray))):
4343
raise TypeError(f"Unsupported type {type(other)}")
4444

4545
return super().__eq__(other).view(MatrixExprCons)
@@ -80,13 +80,13 @@ class MatrixGenExpr(MatrixExpr):
8080
class MatrixExprCons(np.ndarray):
8181

8282
def __le__(self, other: Union[float, int, np.ndarray]) -> MatrixExprCons:
83-
if not _is_number(other) or not isinstance(other, (Expr, MatrixExpr, np.ndarray)):
83+
if not (_is_number(other) or isinstance(other, (Expr, MatrixExpr, np.ndarray))):
8484
raise TypeError(f"Unsupported type {type(other)}")
8585

8686
return super().__le__(other).view(MatrixExprCons)
8787

8888
def __ge__(self, other: Union[float, int, np.ndarray]) -> MatrixExprCons:
89-
if not _is_number(other) or not isinstance(other, (Expr, MatrixExpr, np.ndarray)):
89+
if not (_is_number(other) or isinstance(other, (Expr, MatrixExpr, np.ndarray))):
9090
raise TypeError(f"Unsupported type {type(other)}")
9191

9292
return super().__ge__(other).view(MatrixExprCons)

0 commit comments

Comments
 (0)