From e7ca02646d741cc6dd97579e51f65bba5e3db92b Mon Sep 17 00:00:00 2001 From: "R. Bernstein" Date: Sun, 20 Oct 2024 22:26:17 -0400 Subject: [PATCH] We can tolerate PyPy now... (#1139) Fixes #661 --------- Co-authored-by: Juan Mauricio Matera --- mathics/builtin/drawing/plot.py | 2 +- mathics/builtin/scipy_utils/integrators.py | 3 +-- mathics/builtin/scipy_utils/optimizers.py | 3 +-- mathics/eval/drawing/plot.py | 3 ++- mathics/eval/nevaluator.py | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/mathics/builtin/drawing/plot.py b/mathics/builtin/drawing/plot.py index 3069a9cae..e08af31f6 100644 --- a/mathics/builtin/drawing/plot.py +++ b/mathics/builtin/drawing/plot.py @@ -316,7 +316,7 @@ def eval(self, points, evaluation: Evaluation, options: dict): all_points = ( points.value if hasattr(points, "value") and points.value is not None - else eval_N(points, evaluation).to_python() + else eval_N(points, evaluation).to_python() # TODO: force tuple-ness? ) # FIXME: arrange for self to have a .symbolname property or attribute diff --git a/mathics/builtin/scipy_utils/integrators.py b/mathics/builtin/scipy_utils/integrators.py index 82db83667..39b4c078e 100644 --- a/mathics/builtin/scipy_utils/integrators.py +++ b/mathics/builtin/scipy_utils/integrators.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- from mathics.core.builtin import check_requires_list -from mathics.core.util import IS_PYPY -if IS_PYPY or not check_requires_list(["scipy", "numpy"]): +if not check_requires_list(["scipy", "numpy"]): raise ImportError import numpy as np diff --git a/mathics/builtin/scipy_utils/optimizers.py b/mathics/builtin/scipy_utils/optimizers.py index dcc52b47a..fe76eca3c 100644 --- a/mathics/builtin/scipy_utils/optimizers.py +++ b/mathics/builtin/scipy_utils/optimizers.py @@ -5,10 +5,9 @@ from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression from mathics.core.systemsymbols import SymbolAutomatic, SymbolFailed, SymbolInfinity -from mathics.core.util import IS_PYPY from mathics.eval.nevaluator import eval_N -if IS_PYPY or not check_requires_list(["scipy", "numpy"]): +if not check_requires_list(["scipy", "numpy"]): raise ImportError diff --git a/mathics/eval/drawing/plot.py b/mathics/eval/drawing/plot.py index cc279fe40..3d34424c7 100644 --- a/mathics/eval/drawing/plot.py +++ b/mathics/eval/drawing/plot.py @@ -134,7 +134,8 @@ def quiet_f(*args): def eval_ListPlot( - plot_groups: list, + # TODO: plot_groups should be a tuple only? + plot_groups: Union[list, tuple], x_range: list, y_range: list, is_discrete_plot: bool, diff --git a/mathics/eval/nevaluator.py b/mathics/eval/nevaluator.py index 05751dd64..4dbe16674 100644 --- a/mathics/eval/nevaluator.py +++ b/mathics/eval/nevaluator.py @@ -29,7 +29,7 @@ def eval_N( expression: BaseElement, evaluation: Evaluation, prec: BaseElement = SymbolMachinePrecision, -) -> BaseElement: +) -> Optional[BaseElement]: """ Equivalent to Expression(SymbolN, expression).evaluate(evaluation) """