diff options
author | Pearu Peterson <pearu.peterson@gmail.com> | 2021-09-01 22:54:12 +0300 |
---|---|---|
committer | Pearu Peterson <pearu.peterson@gmail.com> | 2021-09-01 22:54:12 +0300 |
commit | d880dce560fd6369d7418ba83c03cc5947993103 (patch) | |
tree | 31b9866922b6440fe65d688c7d16af3bfae9bed5 /numpy/f2py/symbolic.py | |
parent | 26752c3ad454f72a94cc7db32ccba43a76a85a5e (diff) | |
download | numpy-d880dce560fd6369d7418ba83c03cc5947993103.tar.gz |
Fix bugs and warnings from LGTM report
Diffstat (limited to 'numpy/f2py/symbolic.py')
-rw-r--r-- | numpy/f2py/symbolic.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/numpy/f2py/symbolic.py b/numpy/f2py/symbolic.py index f0b1da288..56faa309c 100644 --- a/numpy/f2py/symbolic.py +++ b/numpy/f2py/symbolic.py @@ -205,6 +205,12 @@ class Expr: return self.data < other.data return NotImplemented + def __le__(self, other): return self == other or self < other + + def __gt__(self, other): return not (self <= other) + + def __ge__(self, other): return not (self < other) + def __repr__(self): return f'{type(self).__name__}({self.op}, {self.data!r})' @@ -354,7 +360,7 @@ class Expr: return normalize(r) if self.op is Op.COMPLEX and other.op in (Op.INTEGER, Op.REAL): return self + as_complex(other) - elif self.op is (Op.INTEGER, Op.REAL) and other.op is Op.COMPLEX: + elif self.op in (Op.INTEGER, Op.REAL) and other.op is Op.COMPLEX: return as_complex(self) + other elif self.op is Op.REAL and other.op is Op.INTEGER: return self + as_real(other, kind=self.data[1]) |