From 6b0fbdac69f1b7baec42ed774fc07a79f3688f6b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 18 Oct 2021 23:03:38 -0700 Subject: [PATCH] For isinstance tests, import Expression from sage.structure.element --- src/sage/arith/misc.py | 4 ++-- src/sage/matrix/matrix0.pyx | 2 +- src/sage/matrix/matrix_integer_dense.pyx | 2 +- src/sage/numerical/optimize.py | 6 +++--- src/sage/rings/asymptotic/asymptotic_ring.py | 2 +- src/sage/rings/complex_arb.pyx | 2 +- src/sage/rings/finite_rings/integer_mod.pyx | 2 +- src/sage/rings/polynomial/laurent_polynomial_ring.py | 4 ++-- src/sage/sets/real_set.py | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/sage/arith/misc.py b/src/sage/arith/misc.py index 651dfb8917d..abb9c256c6b 100644 --- a/src/sage/arith/misc.py +++ b/src/sage/arith/misc.py @@ -4841,7 +4841,7 @@ def falling_factorial(x, a): - Jaap Spies (2006-03-05) """ - from sage.symbolic.expression import Expression + from sage.structure.element import Expression x = py_scalar_to_element(x) a = py_scalar_to_element(a) if (isinstance(a, Integer) or @@ -4935,7 +4935,7 @@ def rising_factorial(x, a): - Jaap Spies (2006-03-05) """ - from sage.symbolic.expression import Expression + from sage.structure.element import Expression x = py_scalar_to_element(x) a = py_scalar_to_element(a) if (isinstance(a, Integer) or diff --git a/src/sage/matrix/matrix0.pyx b/src/sage/matrix/matrix0.pyx index 92c87e3a2ec..b60d3455473 100644 --- a/src/sage/matrix/matrix0.pyx +++ b/src/sage/matrix/matrix0.pyx @@ -5832,7 +5832,7 @@ cdef class Matrix(sage.structure.element.Matrix): [ 2*k + 2 -2*k - 1] [ 2*k + 1 -2*k] """ - from sage.symbolic.expression import Expression + from sage.structure.element import Expression if not self.is_square(): raise ArithmeticError("self must be a square matrix") diff --git a/src/sage/matrix/matrix_integer_dense.pyx b/src/sage/matrix/matrix_integer_dense.pyx index 5422d985eee..9ed2193cd1d 100644 --- a/src/sage/matrix/matrix_integer_dense.pyx +++ b/src/sage/matrix/matrix_integer_dense.pyx @@ -963,7 +963,7 @@ cdef class Matrix_integer_dense(Matrix_dense): try: n = Integer(n) except TypeError: - from sage.symbolic.expression import Expression + from sage.structure.element import Expression if isinstance(n, Expression): from sage.matrix.matrix2 import _matrix_power_symbolic return _matrix_power_symbolic(self, n) diff --git a/src/sage/numerical/optimize.py b/src/sage/numerical/optimize.py index 255e958c2d0..d5677955984 100644 --- a/src/sage/numerical/optimize.py +++ b/src/sage/numerical/optimize.py @@ -384,7 +384,7 @@ def minimize(func, x0, gradient=None, hessian=None, algorithm="default", sage: minimize(rosen, [.1,.3,.4], gradient=rosen_der, algorithm="bfgs") # abs tol 1e-6 (1.0, 1.0, 1.0) """ - from sage.symbolic.expression import Expression + from sage.structure.element import Expression from sage.ext.fast_callable import fast_callable import numpy from scipy import optimize @@ -505,7 +505,7 @@ def minimize_constrained(func,cons,x0,gradient=None,algorithm='default', **args) sage: minimize_constrained(f, c, [100, 300]) (805.985..., 1005.985...) """ - from sage.symbolic.expression import Expression + from sage.structure.element import Expression from sage.ext.fast_callable import fast_callable import numpy from scipy import optimize @@ -751,7 +751,7 @@ def find_fit(data, model, initial_guess = None, parameters = None, variables = N if data.ndim != 2: raise ValueError("data has to be a two dimensional table of floating point numbers") - from sage.symbolic.expression import Expression + from sage.structure.element import Expression if isinstance(model, Expression): if variables is None: diff --git a/src/sage/rings/asymptotic/asymptotic_ring.py b/src/sage/rings/asymptotic/asymptotic_ring.py index a474bf4d1eb..81e3ef38b17 100644 --- a/src/sage/rings/asymptotic/asymptotic_ring.py +++ b/src/sage/rings/asymptotic/asymptotic_ring.py @@ -1684,7 +1684,7 @@ def __pow__(self, exponent, precision=None): else: return self.__pow_number__(exponent, precision=precision) - from sage.symbolic.expression import Expression + from sage.structure.element import Expression if isinstance(exponent, Expression) and exponent.is_constant(): return self.__pow_number__(exponent, precision=precision) diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx index bed8992da3e..52c3d099359 100644 --- a/src/sage/rings/complex_arb.pyx +++ b/src/sage/rings/complex_arb.pyx @@ -650,7 +650,7 @@ class ComplexBallField(UniqueRepresentation, sage.rings.abc.ComplexBallField): # this is not implemented via an _acb_() method, because such a # conversion method would also be called by things like # CBF(re_expr, im_expr). - from sage.symbolic.expression import Expression + from sage.structure.element import Expression if isinstance(x, Expression): # Parse the expression. Despite the method name, the result # will be a complex ball. diff --git a/src/sage/rings/finite_rings/integer_mod.pyx b/src/sage/rings/finite_rings/integer_mod.pyx index 4089c437934..1e947a96a6c 100644 --- a/src/sage/rings/finite_rings/integer_mod.pyx +++ b/src/sage/rings/finite_rings/integer_mod.pyx @@ -380,7 +380,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): try: z = integer_ring.Z(value) except (TypeError, ValueError): - from sage.symbolic.expression import Expression + from sage.structure.element import Expression if isinstance(value, Expression): value = value.pyobject() else: diff --git a/src/sage/rings/polynomial/laurent_polynomial_ring.py b/src/sage/rings/polynomial/laurent_polynomial_ring.py index 3ecdb534370..b0fdb43016d 100644 --- a/src/sage/rings/polynomial/laurent_polynomial_ring.py +++ b/src/sage/rings/polynomial/laurent_polynomial_ring.py @@ -973,7 +973,7 @@ def _element_constructor_(self, x): ... TypeError: fraction must have unit denominator """ - from sage.symbolic.expression import Expression + from sage.structure.element import Expression from sage.rings.fraction_field_element import FractionFieldElement if isinstance(x, Expression): return x.laurent_polynomial(ring=self) @@ -1169,7 +1169,7 @@ def _element_constructor_(self, x, mon=None): sage: R(sum(P.gens()), (-1,-1,-1)) y^-1*z^-1 + x^-1*z^-1 + x^-1*y^-1 """ - from sage.symbolic.expression import Expression + from sage.structure.element import Expression if mon is not None: return self.element_class(self, x, mon) diff --git a/src/sage/sets/real_set.py b/src/sage/sets/real_set.py index fca8d3e179b..0cf6f27fc28 100644 --- a/src/sage/sets/real_set.py +++ b/src/sage/sets/real_set.py @@ -1103,7 +1103,7 @@ def __classcall__(cls, *args, **kwds): if kwds: raise TypeError(f'unless manifold keywords {manifold_keywords} are given, RealSet constructors take no keyword arguments') - from sage.symbolic.expression import Expression + from sage.structure.element import Expression if len(args) == 1 and isinstance(args[0], RealSet): return args[0] # common optimization intervals = []