From 07bb9a799d4d635f586e1809298b341cadeff962 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Mon, 4 Mar 2024 18:16:08 +0100 Subject: Fix __mro__ problem in inheritance --- mdpoly/algebra.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mdpoly/algebra.py b/mdpoly/algebra.py index a9fc806..a2d2325 100644 --- a/mdpoly/algebra.py +++ b/mdpoly/algebra.py @@ -77,7 +77,7 @@ class ExprWithRepr(Expr, HasRepr, Protocol): """ Expression that has a representation """ -class ReducibleExpr(HasRepr, Protocol): +class ReducibleExpr(ExprWithRepr, Protocol): """ Reducible Expression Algebraic expression that can be written in terms of other (existing) @@ -187,7 +187,7 @@ class Add(Expr, HasRepr): return f"({self.left} + {self.right})" -class Sub(Expr, ReducibleExpr): +class Sub(ReducibleExpr): """ Generic subtraction operator (no type check) """ @property @@ -200,7 +200,7 @@ class Sub(Expr, ReducibleExpr): def reduce(self) -> ExprWithRepr: """ See :py:meth:`mdpoly.algebra.ReducibleExpr.reduce`. """ # return self.left + (-1 * self.right) - return Add(self.left, Mul(self._constant(value=-1), self.right)) + return Add(self.left, Mul(Const(value=-1), self.right)) def __repr__(self) -> str: return f"({self.left} - {self.right})" @@ -242,7 +242,7 @@ class Mul(Expr, HasRepr): return f"({self.left} * {self.right})" -class Exp(Expr, ReducibleExpr): +class Exp(ReducibleExpr): """ Generic exponentiation (no type check). """ @property @@ -334,7 +334,7 @@ class PolyMul(Mul, PolyRingAlgebra): @binary_operator(PolyRingAlgebra, PolyRingAlgebra) -class PolyDiv(Expr, ReducibleExpr, PolyRingAlgebra): +class PolyDiv(ReducibleExpr, PolyRingAlgebra): """ Division of scalar polynomial by scalar. """ def reduce(self) -> ExprWithRepr: -- cgit v1.2.1