From 0238f763d32f0771cc9b95868d6cf49ad1698cff Mon Sep 17 00:00:00 2001 From: markus <markus.holzer@fau.de> Date: Sun, 14 Jun 2020 23:13:36 +0200 Subject: [PATCH] fixed sympy import numbers warning --- .gitlab-ci.yml | 1 + pystencils/sympyextensions.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 449e5e222..c163acf27 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,6 +13,7 @@ tests-and-coverage: - $ENABLE_NIGHTLY_BUILDS image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full script: + - pip list - export NUM_CORES=$(nproc --all) - mkdir -p ~/.config/matplotlib - echo "backend:template" > ~/.config/matplotlib/matplotlibrc diff --git a/pystencils/sympyextensions.py b/pystencils/sympyextensions.py index f788dbcd8..cd9519d06 100644 --- a/pystencils/sympyextensions.py +++ b/pystencils/sympyextensions.py @@ -7,6 +7,7 @@ from typing import Callable, Dict, Iterable, List, Optional, Sequence, Tuple, Ty import sympy as sp from sympy.functions import Abs +from sympy.core.numbers import Zero from pystencils.assignment import Assignment from pystencils.data_types import cast_func, get_base_type, get_type_of_expression @@ -260,8 +261,8 @@ def subs_additive(expr: sp.Expr, replacement: sp.Expr, subexpression: sp.Expr, if not param_list: return current_expr else: - if current_expr.func == sp.Mul and sp.numbers.Zero() in param_list: - return sp.numbers.Zero() + if current_expr.func == sp.Mul and Zero() in param_list: + return Zero() else: return current_expr.func(*param_list, evaluate=False) -- GitLab