Skip to content

Commit 3088ebf

Browse files
author
Matthias Koeppe
committed
Remove uses of sage.PACKAGE.all...
1 parent b8968c0 commit 3088ebf

File tree

12 files changed

+132
-106
lines changed

12 files changed

+132
-106
lines changed

src/sage/calculus/test_sympy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
<class 'sage.symbolic.expression.Expression'>
157157
sage: t1, t2
158158
(omega + x, omega + x)
159-
sage: e = sympy.sin(var("y"))+sage.all.cos(sympy.Symbol("x"))
159+
sage: e = sympy.sin(var("y")) + sage.functions.trig.cos(sympy.Symbol("x"))
160160
sage: type(e)
161161
<class 'sympy.core.add.Add'>
162162
sage: e
@@ -166,7 +166,7 @@
166166
<class 'sage.symbolic.expression.Expression'>
167167
sage: e
168168
cos(x) + sin(y)
169-
sage: e = sage.all.cos(var("y")**3)**4+var("x")**2
169+
sage: e = sage.functions.trig.cos(var("y")**3)**4+var("x")**2
170170
sage: e = e._sympy_()
171171
sage: e
172172
x**2 + cos(y**3)**4

src/sage/ext/fast_callable.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,8 @@ def function_name(fn):
576576
Given a function, return a string giving a name for the function.
577577
578578
For functions we recognize, we use our standard opcode name for the
579-
function (so operator.add becomes 'add', and sage.all.sin becomes 'sin').
579+
function (so :func:`operator.add` becomes ``'add'``, and :func:`sage.functions.trig.sin`
580+
becomes ``'sin'``).
580581
581582
For functions we don't recognize, we try to come up with a name,
582583
but the name will be wrapped in braces; this is a signal that

src/sage/groups/generic.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,12 @@
117117

118118
from copy import copy
119119

120+
from sage.arith.misc import integer_ceil, integer_floor, xlcm
121+
from sage.arith.srange import xsrange
122+
from sage.misc.functional import log
120123
from sage.misc.misc_c import prod
121124
import sage.rings.integer_ring as integer_ring
122125
import sage.rings.integer
123-
from sage.arith.srange import xsrange
124126

125127
#
126128
# Lists of names (as strings) which the user may use to identify one
@@ -1396,8 +1398,7 @@ def order_from_bounds(P, bounds, d=None, operation='+',
13961398
if d > 1:
13971399
Q = multiple(P, d, operation=operation)
13981400
lb, ub = bounds
1399-
bounds = (sage.arith.all.integer_ceil(lb / d),
1400-
sage.arith.all.integer_floor(ub / d))
1401+
bounds = (integer_ceil(lb / d), integer_floor(ub / d))
14011402

14021403
# Use generic bsgs to find n=d*m with lb<=n<=ub and n*P=0
14031404

@@ -1486,7 +1487,7 @@ def merge_points(P1, P2, operation='+',
14861487
if n2.divides(n1):
14871488
return (g1, n1)
14881489

1489-
m, k1, k2 = sage.arith.all.xlcm(n1, n2)
1490+
m, k1, k2 = xlcm(n1, n2)
14901491
m1 = n1 // k1
14911492
m2 = n2 // k2
14921493
g1 = multiple(g1, m1, operation=operation)

src/sage/rings/bernoulli_mod_p.pyx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ AUTHOR:
2323
# https://www.gnu.org/licenses/
2424
# ****************************************************************************
2525

26+
from sage.arith.misc import is_prime, primitive_root
27+
2628
cimport sage.rings.fast_arith
2729
import sage.rings.fast_arith
2830
cdef sage.rings.fast_arith.arith_int arith_int
@@ -135,12 +137,12 @@ def bernoulli_mod_p(int p):
135137
if p <= 2:
136138
raise ValueError("p (=%s) must be a prime >= 3" % p)
137139

138-
if not sage.arith.all.is_prime(p):
140+
if not is_prime(p):
139141
raise ValueError("p (=%s) must be a prime" % p)
140142

141143
cdef int g, gSqr, gInv, gInvSqr, isOdd
142144

143-
g = sage.arith.all.primitive_root(p)
145+
g = primitive_root(p)
144146
gInv = arith_int.c_inverse_mod_int(g, p)
145147
gSqr = ((<llong> g) * g) % p
146148
gInvSqr = ((<llong> gInv) * gInv) % p
@@ -303,7 +305,7 @@ def bernoulli_mod_p_single(long p, long k):
303305
if p <= 2:
304306
raise ValueError("p (=%s) must be a prime >= 3" % p)
305307

306-
if not sage.arith.all.is_prime(p):
308+
if not is_prime(p):
307309
raise ValueError("p (=%s) must be a prime" % p)
308310

309311
cdef long x = bernmm_bern_modp(p, k)

src/sage/rings/finite_rings/element_givaro.pyx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,11 @@ from cysignals.signals cimport sig_on, sig_off
5656

5757
from cypari2.paridecl cimport *
5858

59+
import sage.arith.misc
60+
5961
from sage.misc.randstate cimport current_randstate
6062
from sage.rings.finite_rings.element_pari_ffelt cimport FiniteFieldElement_pari_ffelt
6163
from sage.structure.richcmp cimport richcmp
62-
import sage.arith.all
6364

6465
from cypari2.gen cimport Gen
6566
from cypari2.stack cimport clear_stack
@@ -414,9 +415,6 @@ cdef class Cache_givaro(Cache_base):
414415
# Reduce to pari
415416
e = e.__pari__()
416417

417-
elif isinstance(e, sage.libs.gap.element.GapElement_FiniteField):
418-
return e.sage(ring=self.parent)
419-
420418
elif isinstance(e, GapElement):
421419
from sage.libs.gap.libgap import libgap
422420
return libgap(e).sage(ring=self.parent)
@@ -434,6 +432,13 @@ cdef class Cache_givaro(Cache_base):
434432
return ret
435433

436434
else:
435+
try:
436+
from sage.libs.gap.element import GapElement_FiniteField
437+
except ImportError:
438+
pass
439+
else:
440+
if isinstance(e, GapElement_FiniteField):
441+
return e.sage(ring=self.parent)
437442
raise TypeError("unable to coerce %r" % type(e))
438443

439444
cdef GEN t
@@ -1568,7 +1573,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement):
15681573
raise ArithmeticError("Multiplicative order of 0 not defined.")
15691574
n = (self._cache).order_c() - 1
15701575
order = Integer(1)
1571-
for p, e in sage.arith.all.factor(n):
1576+
for p, e in sage.arith.misc.factor(n):
15721577
# Determine the power of p that divides the order.
15731578
a = self**(n / (p**e))
15741579
while a != 1:

src/sage/rings/integer.pyx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ from cysignals.signals cimport sig_on, sig_off, sig_check, sig_occurred
153153

154154
import operator
155155

156+
import sage.arith.misc
157+
156158
from sage.ext.stdsage cimport PY_NEW
157159
from sage.cpython.python_debug cimport if_Py_TRACE_REFS_then_PyObject_INIT
158160

@@ -4076,7 +4078,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement):
40764078
"""
40774079
if self.is_zero():
40784080
raise ArithmeticError("support of 0 not defined")
4079-
return sage.arith.all.prime_factors(self)
4081+
return sage.arith.misc.prime_factors(self)
40804082

40814083
def coprime_integers(self, m):
40824084
"""

0 commit comments

Comments
 (0)