From 38f05a839c444fcf927717f3b99d8f273a55ac2d Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Mon, 16 Feb 2015 18:05:35 -0600 Subject: [PATCH] Py3 fix --- pymbolic/mapper/constant_folder.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pymbolic/mapper/constant_folder.py b/pymbolic/mapper/constant_folder.py index d682369..b642fa6 100644 --- a/pymbolic/mapper/constant_folder.py +++ b/pymbolic/mapper/constant_folder.py @@ -22,13 +22,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ +from six.moves import reduce from pymbolic.mapper import \ IdentityMapper, \ CSECachingMapperMixin - - class ConstantFoldingMapperBase(object): def is_constant(self, expr): from pymbolic.mapper.dependency import DependencyMapper @@ -75,7 +74,6 @@ class ConstantFoldingMapperBase(object): return self.fold(expr, Sum, operator.add, flattened_sum) - class CommutativeConstantFoldingMapperBase(ConstantFoldingMapperBase): def map_product(self, expr): from pymbolic.primitives import Product, flattened_product @@ -84,16 +82,15 @@ class CommutativeConstantFoldingMapperBase(ConstantFoldingMapperBase): return self.fold(expr, Product, operator.mul, flattened_product) - - class ConstantFoldingMapper( - CSECachingMapperMixin, - ConstantFoldingMapperBase, + CSECachingMapperMixin, + ConstantFoldingMapperBase, IdentityMapper): map_common_subexpression_uncached = \ IdentityMapper.map_common_subexpression + class CommutativeConstantFoldingMapper( CSECachingMapperMixin, CommutativeConstantFoldingMapperBase, -- GitLab