Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Call sympy_init in all added _sympy_ methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Jun 9, 2021
1 parent 9fcf32e commit 93fbb2b
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/sage/categories/sets_cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2451,6 +2451,8 @@ def _sympy_(self):
True
"""
from sympy import ProductSet
from sage.interfaces.sympy import sympy_init
sympy_init()
return ProductSet(*self.cartesian_factors())

class ElementMethods:
Expand Down
2 changes: 2 additions & 0 deletions src/sage/modules/free_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -5318,6 +5318,8 @@ def _sympy_(self):
True
"""
from sympy import ProductSet
from sage.interfaces.sympy import sympy_init
sympy_init()
return ProductSet(*([self.coordinate_ring()] * self.rank()))


Expand Down
2 changes: 2 additions & 0 deletions src/sage/rings/integer_ring.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1477,6 +1477,8 @@ cdef class IntegerRing_class(PrincipalIdealDomain):
Integers
"""
from sympy import Integers
from sage.interfaces.sympy import sympy_init
sympy_init()
return Integers

def _sage_input_(self, sib, coerced):
Expand Down
2 changes: 2 additions & 0 deletions src/sage/rings/rational_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -1586,6 +1586,8 @@ def _sympy_(self):
Rationals
"""
from sympy import Rationals
from sage.interfaces.sympy import sympy_init
sympy_init()
return Rationals

def _sage_input_(self, sib, coerced):
Expand Down
2 changes: 2 additions & 0 deletions src/sage/sets/non_negative_integers.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,6 @@ def _sympy_(self):
Naturals0
"""
from sympy import Naturals0
from sage.interfaces.sympy import sympy_init
sympy_init()
return Naturals0
2 changes: 2 additions & 0 deletions src/sage/sets/positive_integers.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,6 @@ def _sympy_(self):
Naturals
"""
from sympy import Naturals
from sage.interfaces.sympy import sympy_init
sympy_init()
return Naturals
4 changes: 4 additions & 0 deletions src/sage/sets/real_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,8 @@ def _sympy_(self):
Interval.open(0, oo)
"""
from sympy import Interval
from sage.interfaces.sympy import sympy_init
sympy_init()
return Interval(self.lower(), self.upper(),
left_open=not self._lower_closed,
right_open=not self._upper_closed)
Expand Down Expand Up @@ -1869,6 +1871,8 @@ def _sympy_(self):
False
"""
from sympy import Reals, Union
from sage.interfaces.sympy import sympy_init
sympy_init()
if self.is_universe():
return Reals
else:
Expand Down

0 comments on commit 93fbb2b

Please sign in to comment.