@@ -27,19 +27,19 @@ class MatrixExpr(np.ndarray):
27
27
return res if res.size > 1 else res.item()
28
28
29
29
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 ) )):
31
31
raise TypeError (f" Unsupported type {type(other)}" )
32
32
33
33
return super ().__le__(other).view(MatrixExprCons)
34
34
35
35
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 ) )):
37
37
raise TypeError (f" Unsupported type {type(other)}" )
38
38
39
39
return super ().__ge__(other).view(MatrixExprCons)
40
40
41
41
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 ) )):
43
43
raise TypeError (f" Unsupported type {type(other)}" )
44
44
45
45
return super ().__eq__(other).view(MatrixExprCons)
@@ -80,13 +80,13 @@ class MatrixGenExpr(MatrixExpr):
80
80
class MatrixExprCons (np.ndarray ):
81
81
82
82
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 ) )):
84
84
raise TypeError (f" Unsupported type {type(other)}" )
85
85
86
86
return super ().__le__(other).view(MatrixExprCons)
87
87
88
88
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 ) )):
90
90
raise TypeError (f" Unsupported type {type(other)}" )
91
91
92
92
return super ().__ge__(other).view(MatrixExprCons)
0 commit comments