Skip to content

Commit 68e3791

Browse files
author
Release Manager
committed
gh-39273: Fix remaining all imports <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes #12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes #12345". --> This should take care of the remaining imports from `all`. (There are still a couple of them, but they are okay to leave I think.) ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> URL: #39273 Reported by: Tobias Diez Reviewer(s): Dima Pasechnik, Tobias Diez
2 parents a40fc0a + 98622c8 commit 68e3791

File tree

91 files changed

+269
-229
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+269
-229
lines changed

src/sage/arith/misc.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,7 +1705,7 @@ def plot(self, xmin=1, xmax=50, k=1, pointsize=30, rgbcolor=(0, 0, 1), join=True
17051705
124.0
17061706
"""
17071707
v = [(n, sigma(n, k)) for n in range(xmin, xmax + 1)]
1708-
from sage.plot.all import list_plot
1708+
from sage.plot.plot import list_plot
17091709
P = list_plot(v, pointsize=pointsize, rgbcolor=rgbcolor, **kwds)
17101710
if join:
17111711
P += list_plot(v, plotjoined=True, rgbcolor=(0.7, 0.7, 0.7), **kwds)
@@ -3193,7 +3193,7 @@ def plot(self, xmin=1, xmax=50, pointsize=30, rgbcolor=(0, 0, 1),
31933193
46.0
31943194
"""
31953195
v = [(n, euler_phi(n)) for n in range(xmin, xmax + 1)]
3196-
from sage.plot.all import list_plot
3196+
from sage.plot.plot import list_plot
31973197
P = list_plot(v, pointsize=pointsize, rgbcolor=rgbcolor, **kwds)
31983198
if join:
31993199
P += list_plot(v, plotjoined=True, rgbcolor=(0.7, 0.7, 0.7), **kwds)
@@ -4743,7 +4743,7 @@ def plot(self, xmin=0, xmax=50, pointsize=30, rgbcolor=(0, 0, 1), join=True,
47434743
"""
47444744
values = self.range(xmin, xmax + 1)
47454745
v = [(n, values[n - xmin]) for n in range(xmin, xmax + 1)]
4746-
from sage.plot.all import list_plot
4746+
from sage.plot.plot import list_plot
47474747
P = list_plot(v, pointsize=pointsize, rgbcolor=rgbcolor, **kwds)
47484748
if join:
47494749
P += list_plot(v, plotjoined=True, rgbcolor=(0.7, 0.7, 0.7), **kwds)
@@ -5271,7 +5271,7 @@ def falling_factorial(x, a):
52715271
(isinstance(a, Expression) and
52725272
a.is_integer())) and a >= 0:
52735273
return prod(((x - i) for i in range(a)), z=x.parent().one())
5274-
from sage.functions.all import gamma
5274+
from sage.functions.gamma import gamma
52755275
return gamma(x + 1) / gamma(x - a + 1)
52765276

52775277

@@ -5363,7 +5363,7 @@ def rising_factorial(x, a):
53635363
(isinstance(a, Expression) and
53645364
a.is_integer())) and a >= 0:
53655365
return prod(((x + i) for i in range(a)), z=x.parent().one())
5366-
from sage.functions.all import gamma
5366+
from sage.functions.gamma import gamma
53675367
return gamma(x + a) / gamma(x)
53685368

53695369

src/sage/calculus/desolvers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,7 @@ def desolve_rk4_inner(de, dvar):
13651365

13661366
if not (isinstance(dvar, Expression) and dvar.is_symbol()):
13671367
from sage.symbolic.ring import SR
1368-
from sage.calculus.all import diff
1368+
from sage.calculus.functional import diff
13691369
from sage.symbolic.relation import solve
13701370
if isinstance(de, Expression) and de.is_relational():
13711371
de = de.lhs() - de.rhs()

src/sage/calculus/riemann.pyx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ cdef class Riemann_Map:
744744
sage: m.plot_boundaries(plotjoined=False, rgbcolor=[0,0,1], thickness=6) # needs sage.plot
745745
Graphics object consisting of 1 graphics primitive
746746
"""
747-
from sage.plot.all import list_plot
747+
from sage.plot.plot import list_plot
748748

749749
if rgbcolor is None:
750750
rgbcolor = [0, 0, 0]
@@ -942,7 +942,8 @@ cdef class Riemann_Map:
942942
....: thickness=2.0, min_mag=0.1)
943943
"""
944944
from sage.plot.complex_plot import ComplexPlot
945-
from sage.plot.all import list_plot, Graphics
945+
from sage.plot.plot import list_plot
946+
from sage.plot.graphics import Graphics
946947

947948
cdef int k, i
948949
if self.exterior:
@@ -1068,7 +1069,7 @@ cdef class Riemann_Map:
10681069
Graphics object consisting of 1 graphics primitive
10691070
"""
10701071
from sage.plot.complex_plot import ComplexPlot
1071-
from sage.plot.all import Graphics
1072+
from sage.plot.graphics import Graphics
10721073

10731074
if plot_range is None:
10741075
plot_range = []

src/sage/categories/examples/finite_coxeter_groups.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def __contains__(self, x):
129129
130130
(also tested by :meth:`test_an_element` :meth:`test_some_elements`)
131131
"""
132-
from sage.structure.all import parent
132+
from sage.structure.element import parent
133133
return parent(x) is self
134134

135135
@cached_method

src/sage/categories/number_fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def zeta_function(self, prec=53,
185185
PARI zeta function associated to Rational Field
186186
"""
187187
if algorithm == 'gp':
188-
from sage.lfunctions.all import Dokchitser
188+
from sage.lfunctions.dokchitser import Dokchitser
189189
r1, r2 = self.signature()
190190
zero = [0]
191191
one = [1]

src/sage/categories/sets_cat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
from sage.misc.lazy_attribute import lazy_attribute
3737
from sage.misc.lazy_import import lazy_import, LazyImport
3838
from sage.misc.lazy_format import LazyFormat
39+
# Do not use sage.categories.all here to avoid initialization loop
3940
from sage.categories.category import Category
4041
from sage.categories.category_singleton import Category_singleton
41-
# Do not use sage.categories.all here to avoid initialization loop
4242
from sage.categories.sets_with_partial_maps import SetsWithPartialMaps
4343
from sage.categories.subquotients import SubquotientsCategory
4444
from sage.categories.quotients import QuotientsCategory

src/sage/coding/goppa_code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from sage.coding.linear_code import AbstractLinearCode
3434
from sage.coding.encoder import Encoder
3535
from sage.modules.free_module_element import vector
36-
from sage.coding.all import codes
36+
import sage.coding.codes_catalog as codes
3737

3838

3939
def _columnize(element):

src/sage/combinat/combinat.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,21 +122,22 @@
122122
# https://www.gnu.org/licenses/
123123
# ****************************************************************************
124124
from __future__ import annotations
125+
125126
from collections.abc import Iterator
126127

127128
from sage.arith.misc import bernoulli, factorial
128-
from sage.rings.integer_ring import ZZ
129-
from sage.rings.rational_field import QQ
129+
from sage.combinat.combinat_cython import _stirling_number2
130+
from sage.misc.cachefunc import cached_function
131+
from sage.misc.inherit_comparison import InheritComparisonClasscallMetaclass
132+
from sage.misc.lazy_import import lazy_import
133+
from sage.misc.misc_c import prod
130134
from sage.rings.integer import Integer
135+
from sage.rings.integer_ring import ZZ
131136
from sage.rings.polynomial.polynomial_element import Polynomial
132137
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
133-
from sage.misc.misc_c import prod
134-
from sage.misc.cachefunc import cached_function
135-
from sage.structure.sage_object import SageObject
136-
from sage.misc.lazy_import import lazy_import
137-
from .combinat_cython import _stirling_number2
138-
from sage.misc.inherit_comparison import InheritComparisonClasscallMetaclass
138+
from sage.rings.rational_field import QQ
139139
from sage.structure.element import Element
140+
from sage.structure.sage_object import SageObject
140141

141142
lazy_import('sage.interfaces.maxima_lib', 'maxima')
142143
lazy_import('sage.libs.pari', 'pari')
@@ -339,7 +340,7 @@ def bell_number(n, algorithm='flint', **options) -> Integer:
339340
if n < 0:
340341
raise ArithmeticError('Bell numbers not defined for negative indices')
341342
if algorithm == 'mpmath':
342-
from sage.libs.mpmath.all import bell, mp, mag
343+
from mpmath import bell, mag, mp
343344
old_prec = mp.dps
344345
if 'prec' in options:
345346
mp.dps = options['prec']
@@ -2052,8 +2053,8 @@ def bell_polynomial(n: Integer, k=None, ordinary=False):
20522053
- [Bel1927]_
20532054
- [Com1974]_
20542055
"""
2055-
from sage.combinat.partition import Partitions
20562056
from sage.arith.misc import multinomial
2057+
from sage.combinat.partition import Partitions
20572058
if k is None:
20582059
partitions = Partitions(n)
20592060
# We set k = 1 to use the correct ring

src/sage/combinat/designs/block_design.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def are_hyperplanes_in_projective_geometry_parameters(v, k, lmbda, return_parame
148148
....: assert are_hyperplanes_in_projective_geometry_parameters(v,k,l+1) is False
149149
....: assert are_hyperplanes_in_projective_geometry_parameters(v,k,l-1) is False
150150
"""
151-
import sage.arith.all as arith
151+
from sage.arith.misc import gcd
152152

153153
q1 = Integer(v - k)
154154
q2 = Integer(k - lmbda)
@@ -161,7 +161,7 @@ def are_hyperplanes_in_projective_geometry_parameters(v, k, lmbda, return_parame
161161
p1,e1 = q1.factor()[0]
162162
p2,e2 = q2.factor()[0]
163163

164-
k = arith.gcd(e1,e2)
164+
k = gcd(e1,e2)
165165
d = e1//k
166166
q = p1**k
167167
if e2//k != d-1 or lmbda != (q**(d-1)-1)//(q-1):

src/sage/combinat/designs/difference_family.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,10 @@
4747
# https://www.gnu.org/licenses/
4848
# ****************************************************************************
4949

50-
from sage.arith.misc import is_prime_power
50+
from sage.arith.misc import is_prime_power, is_square, factor
5151
from sage.misc.cachefunc import cached_function
5252

5353
from sage.categories.sets_cat import EmptySetError
54-
import sage.arith.all as arith
5554
from sage.misc.unknown import Unknown
5655
from sage.rings.finite_rings.integer_mod_ring import Zmod
5756
from sage.rings.integer import Integer
@@ -572,13 +571,13 @@ def radical_difference_set(K, k, l=1, existence=False, check=True):
572571
add_zero = True
573572

574573
# q = 4t^2 + 1, t odd
575-
elif v % 8 == 5 and k == (v-1)//4 and arith.is_square((v-1)//4):
574+
elif v % 8 == 5 and k == (v-1)//4 and is_square((v-1)//4):
576575
if existence:
577576
return True
578577
add_zero = False
579578

580579
# q = 4t^2 + 9, t odd
581-
elif v % 8 == 5 and k == (v+3)//4 and arith.is_square((v-9)//4):
580+
elif v % 8 == 5 and k == (v+3)//4 and is_square((v-9)//4):
582581
if existence:
583582
return True
584583
add_zero = True
@@ -3823,7 +3822,7 @@ def difference_family(v, k, l=1, existence=False, explain_construction=False, ch
38233822
G = Zmod(v)
38243823
return G, [list(range(1, v))]
38253824

3826-
factorization = arith.factor(v)
3825+
factorization = factor(v)
38273826
if len(factorization) == 1:
38283827
from sage.rings.finite_rings.finite_field_constructor import GF
38293828
K = GF(v,'z')

0 commit comments

Comments
 (0)