Skip to content

Commit

Permalink
Fix remaining all imports
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasdiez committed Jan 4, 2025
1 parent c9dd1e8 commit 3699e87
Show file tree
Hide file tree
Showing 94 changed files with 203 additions and 156 deletions.
10 changes: 5 additions & 5 deletions src/sage/arith/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1706,7 +1706,7 @@ def plot(self, xmin=1, xmax=50, k=1, pointsize=30, rgbcolor=(0,0,1), join=True,
124.0
"""
v = [(n, sigma(n, k)) for n in range(xmin, xmax + 1)]
from sage.plot.all import list_plot
from sage.plot.plot import list_plot
P = list_plot(v, pointsize=pointsize, rgbcolor=rgbcolor, **kwds)
if join:
P += list_plot(v, plotjoined=True, rgbcolor=(0.7,0.7,0.7), **kwds)
Expand Down Expand Up @@ -3194,7 +3194,7 @@ def plot(self, xmin=1, xmax=50, pointsize=30, rgbcolor=(0, 0, 1),
46.0
"""
v = [(n, euler_phi(n)) for n in range(xmin, xmax + 1)]
from sage.plot.all import list_plot
from sage.plot.plot import list_plot
P = list_plot(v, pointsize=pointsize, rgbcolor=rgbcolor, **kwds)
if join:
P += list_plot(v, plotjoined=True, rgbcolor=(0.7,0.7,0.7), **kwds)
Expand Down Expand Up @@ -4645,7 +4645,7 @@ def plot(self, xmin=0, xmax=50, pointsize=30, rgbcolor=(0,0,1), join=True,
"""
values = self.range(xmin, xmax + 1)
v = [(n,values[n-xmin]) for n in range(xmin,xmax + 1)]
from sage.plot.all import list_plot
from sage.plot.plot import list_plot
P = list_plot(v, pointsize=pointsize, rgbcolor=rgbcolor, **kwds)
if join:
P += list_plot(v, plotjoined=True, rgbcolor=(0.7,0.7,0.7), **kwds)
Expand Down Expand Up @@ -5173,7 +5173,7 @@ def falling_factorial(x, a):
(isinstance(a, Expression) and
a.is_integer())) and a >= 0:
return prod(((x - i) for i in range(a)), z=x.parent().one())
from sage.functions.all import gamma
from sage.functions.gamma import gamma
return gamma(x + 1) / gamma(x - a + 1)


Expand Down Expand Up @@ -5265,7 +5265,7 @@ def rising_factorial(x, a):
(isinstance(a, Expression) and
a.is_integer())) and a >= 0:
return prod(((x + i) for i in range(a)), z=x.parent().one())
from sage.functions.all import gamma
from sage.functions.gamma import gamma
return gamma(x + a) / gamma(x)


Expand Down
2 changes: 1 addition & 1 deletion src/sage/calculus/desolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,7 @@ def desolve_rk4_inner(de, dvar):

if not (isinstance(dvar, Expression) and dvar.is_symbol()):
from sage.symbolic.ring import SR
from sage.calculus.all import diff
from sage.calculus.functional import diff
from sage.symbolic.relation import solve
if isinstance(de, Expression) and de.is_relational():
de = de.lhs() - de.rhs()
Expand Down
7 changes: 4 additions & 3 deletions src/sage/calculus/riemann.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ cdef class Riemann_Map:
sage: m.plot_boundaries(plotjoined=False, rgbcolor=[0,0,1], thickness=6) # needs sage.plot
Graphics object consisting of 1 graphics primitive
"""
from sage.plot.all import list_plot
from sage.plot.plot import list_plot

plots = list(range(self.B))
for k in range(self.B):
Expand Down Expand Up @@ -939,7 +939,8 @@ cdef class Riemann_Map:
....: thickness=2.0, min_mag=0.1)
"""
from sage.plot.complex_plot import ComplexPlot
from sage.plot.all import list_plot, Graphics
from sage.plot.plot import list_plot
from sage.plot.graphics import Graphics

cdef int k, i
if self.exterior:
Expand Down Expand Up @@ -1051,7 +1052,7 @@ cdef class Riemann_Map:
Graphics object consisting of 1 graphics primitive
"""
from sage.plot.complex_plot import ComplexPlot
from sage.plot.all import Graphics
from sage.plot.graphics import Graphics

z_values, xmin, xmax, ymin, ymax = self.compute_on_grid(plot_range,
plot_points)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/examples/finite_coxeter_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def __contains__(self, x):
(also tested by :meth:`test_an_element` :meth:`test_some_elements`)
"""
from sage.structure.all import parent
from sage.structure.element import parent
return parent(x) is self

@cached_method
Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/number_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def zeta_function(self, prec=53,
PARI zeta function associated to Rational Field
"""
if algorithm == 'gp':
from sage.lfunctions.all import Dokchitser
from sage.lfunctions.dokchitser import Dokchitser
r1, r2 = self.signature()
zero = [0]
one = [1]
Expand Down
1 change: 0 additions & 1 deletion src/sage/categories/sets_cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
from sage.misc.lazy_format import LazyFormat
from sage.categories.category import Category
from sage.categories.category_singleton import Category_singleton
# Do not use sage.categories.all here to avoid initialization loop
from sage.categories.sets_with_partial_maps import SetsWithPartialMaps
from sage.categories.subquotients import SubquotientsCategory
from sage.categories.quotients import QuotientsCategory
Expand Down
2 changes: 1 addition & 1 deletion src/sage/coding/goppa_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from sage.coding.linear_code import AbstractLinearCode
from sage.coding.encoder import Encoder
from sage.modules.free_module_element import vector
from sage.coding.all import codes
import sage.coding.codes_catalog as codes


def _columnize(element):
Expand Down
3 changes: 2 additions & 1 deletion src/sage/combinat/combinat.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,8 @@ def bell_number(n, algorithm='flint', **options) -> Integer:
if n < 0:
raise ArithmeticError('Bell numbers not defined for negative indices')
if algorithm == 'mpmath':
from sage.libs.mpmath.all import bell, mp, mag
from sage.libs.mpmath.all import bell, mag
from mpmath import mp
old_prec = mp.dps
if 'prec' in options:
mp.dps = options['prec']
Expand Down
4 changes: 2 additions & 2 deletions src/sage/combinat/designs/block_design.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def are_hyperplanes_in_projective_geometry_parameters(v, k, lmbda, return_parame
....: assert are_hyperplanes_in_projective_geometry_parameters(v,k,l+1) is False
....: assert are_hyperplanes_in_projective_geometry_parameters(v,k,l-1) is False
"""
import sage.arith.all as arith
from sage.arith.misc import gcd

q1 = Integer(v - k)
q2 = Integer(k - lmbda)
Expand All @@ -161,7 +161,7 @@ def are_hyperplanes_in_projective_geometry_parameters(v, k, lmbda, return_parame
p1,e1 = q1.factor()[0]
p2,e2 = q2.factor()[0]

k = arith.gcd(e1,e2)
k = gcd(e1,e2)
d = e1//k
q = p1**k
if e2//k != d-1 or lmbda != (q**(d-1)-1)//(q-1):
Expand Down
9 changes: 4 additions & 5 deletions src/sage/combinat/designs/difference_family.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.arith.misc import is_prime_power
from sage.arith.misc import is_prime_power, is_square, factor
from sage.misc.cachefunc import cached_function

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

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

# q = 4t^2 + 9, t odd
elif v % 8 == 5 and k == (v+3)//4 and arith.is_square((v-9)//4):
elif v % 8 == 5 and k == (v+3)//4 and is_square((v-9)//4):
if existence:
return True
add_zero = True
Expand Down Expand Up @@ -3828,7 +3827,7 @@ def difference_family(v, k, l=1, existence=False, explain_construction=False, ch
G = Zmod(v)
return G, [list(range(1, v))]

factorization = arith.factor(v)
factorization = factor(v)
if len(factorization) == 1:
from sage.rings.finite_rings.finite_field_constructor import GF
K = GF(v,'z')
Expand Down
3 changes: 2 additions & 1 deletion src/sage/combinat/sf/dual.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#
# https://www.gnu.org/licenses/
#*****************************************************************************
from sage.categories.modules_with_basis import ModulesWithBasis
from sage.categories.morphism import SetMorphism
from sage.categories.homset import Hom
from sage.matrix.constructor import matrix
Expand Down Expand Up @@ -166,7 +167,7 @@ def __init__(self, dual_basis, scalar, scalar_name, basis_name, prefix):
prefix=prefix)

# temporary until Hom(GradedHopfAlgebrasWithBasis work better)
category = sage.categories.all.ModulesWithBasis(self.base_ring())
category = ModulesWithBasis(self.base_ring())
self.register_coercion(SetMorphism(Hom(self._dual_basis, self, category), self._dual_to_self))
self._dual_basis.register_coercion(SetMorphism(Hom(self, self._dual_basis, category), self._self_to_dual))

Expand Down
7 changes: 4 additions & 3 deletions src/sage/combinat/sf/hall_littlewood.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
# http://www.gnu.org/licenses/
#*****************************************************************************

from sage.categories.modules_with_basis import ModulesWithBasis
from sage.structure.unique_representation import UniqueRepresentation
from sage.libs.symmetrica.all import hall_littlewood
from sage.libs.symmetrica.symmetrica import hall_littlewood_symmetrica as hall_littlewood
from . import sfa
import sage.combinat.partition
from sage.matrix.constructor import matrix
Expand Down Expand Up @@ -385,7 +386,7 @@ def __init__(self, hall_littlewood):
# common category BasesByOrthotriangularity (shared with Jack, HL, orthotriang, Mcdo)
if hasattr(self, "_s_cache"):
# temporary until Hom(GradedHopfAlgebrasWithBasis work better)
category = sage.categories.all.ModulesWithBasis(self._sym.base_ring())
category = ModulesWithBasis(self._sym.base_ring())
self .register_coercion(SetMorphism(Hom(self._s, self, category), self._s_to_self))
self._s.register_coercion(SetMorphism(Hom(self, self._s, category), self._self_to_s))

Expand Down Expand Up @@ -856,7 +857,7 @@ def __init__(self, hall_littlewood):

self._P = self._hall_littlewood.P()
# temporary until Hom(GradedHopfAlgebrasWithBasis work better)
category = sage.categories.all.ModulesWithBasis(self.base_ring())
category = ModulesWithBasis(self.base_ring())

phi = self.module_morphism(diagonal=self._P._q_to_p_normalization,
codomain=self._P, category=category)
Expand Down
12 changes: 6 additions & 6 deletions src/sage/combinat/sf/jack.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.categories.modules_with_basis import ModulesWithBasis
from sage.structure.unique_representation import UniqueRepresentation
import sage.categories.all
from sage.rings.integer import Integer
from sage.rings.rational_field import QQ
from sage.arith.misc import gcd
Expand Down Expand Up @@ -525,13 +525,13 @@ def __init__(self, jack):
# common category BasesByOrthotriangularity (shared with Jack, HL, orthotriang, Mcdo)
if hasattr(self, "_m_cache"):
# temporary until Hom(GradedHopfAlgebrasWithBasis work better)
category = sage.categories.all.ModulesWithBasis(self._sym.base_ring())
category = ModulesWithBasis(self._sym.base_ring())
self._m = self._sym.monomial()
self .register_coercion(SetMorphism(Hom(self._m, self, category), self._m_to_self))
self._m.register_coercion(SetMorphism(Hom(self, self._m, category), self._self_to_m))
if hasattr(self, "_h_cache"):
# temporary until Hom(GradedHopfAlgebrasWithBasis work better)
category = sage.categories.all.ModulesWithBasis(self._sym.base_ring())
category = ModulesWithBasis(self._sym.base_ring())
self._h = self._sym.homogeneous()
self .register_coercion(SetMorphism(Hom(self._h, self, category), self._h_to_self))
self._h.register_coercion(SetMorphism(Hom(self, self._h, category), self._self_to_h))
Expand Down Expand Up @@ -1080,7 +1080,7 @@ def __init__(self, jack):
# Should be shared with _q (and possibly other bases in Macdo/HL) as BasesByRenormalization
self._P = self._jack.P()
# temporary until Hom(GradedHopfAlgebrasWithBasis) works better
category = sage.categories.all.ModulesWithBasis(self.base_ring())
category = ModulesWithBasis(self.base_ring())
phi = self.module_morphism(diagonal=self.c1,
codomain=self._P, category=category)
# should use module_morphism(on_coeffs = ...) once it exists
Expand Down Expand Up @@ -1116,7 +1116,7 @@ def __init__(self, jack):
# Should be shared with _j (and possibly other bases in Macdo/HL) as BasesByRenormalization
self._P = self._jack.P()
# temporary until Hom(GradedHopfAlgebrasWithBasis) works better
category = sage.categories.all.ModulesWithBasis(self.base_ring())
category = ModulesWithBasis(self.base_ring())
phi = self._P.module_morphism(diagonal=self._P.scalar_jack_basis,
codomain=self, category=category)
self.register_coercion(self._normalize_morphism(category) * phi)
Expand Down Expand Up @@ -1348,7 +1348,7 @@ def __init__(self, Sym):
#self._self_to_m_cache = {} and we don't need to compute it separately for zonals
sfa.SymmetricFunctionAlgebra_generic.__init__(self, self._sym,
prefix='Z', basis_name='zonal')
category = sage.categories.all.ModulesWithBasis(self._sym.base_ring())
category = ModulesWithBasis(self._sym.base_ring())
self .register_coercion(SetMorphism(Hom(self._P, self, category), self.sum_of_terms))
self._P.register_coercion(SetMorphism(Hom(self, self._P, category), self._P.sum_of_terms))

Expand Down
3 changes: 2 additions & 1 deletion src/sage/combinat/sf/llt.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#
# https://www.gnu.org/licenses/
# ****************************************************************************
from sage.categories.modules_with_basis import ModulesWithBasis
from sage.structure.unique_representation import UniqueRepresentation
from . import sfa
import sage.combinat.ribbon_tableau as ribbon_tableau
Expand Down Expand Up @@ -450,7 +451,7 @@ def __init__(self, llt, prefix):
sfa.SymmetricFunctionAlgebra_generic.__init__(self, self._sym, self._basis_name)

# temporary until Hom(GradedHopfAlgebrasWithBasis work better)
category = sage.categories.all.ModulesWithBasis(self._sym.base_ring())
category = ModulesWithBasis(self._sym.base_ring())
self._m = llt._sym.m()
self .register_coercion(SetMorphism(Hom(self._m, self, category), self._m_to_self))
self._m.register_coercion(SetMorphism(Hom(self, self._m, category), self._self_to_m))
Expand Down
6 changes: 4 additions & 2 deletions src/sage/combinat/words/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -1393,7 +1393,7 @@ def plot_projection(self, v=None, letters=None, color=None, ring=None,
if letters is None:
letters = self.parent().alphabet()
if color is None:
from sage.plot.all import hue
from sage.plot.colors import hue
A = self.parent().alphabet()
color = {a: hue(A.rank(a) / float(A.cardinality())) for a in A}
it = self.projected_point_iterator(v, ring=ring)
Expand Down Expand Up @@ -1655,7 +1655,9 @@ def animate(self):
See www.imagemagick.org, for example.
"""
from sage.plot.all import line, polygon, animate
from sage.plot.line import line
from sage.plot.polygon import polygon
from sage.plot.animate import animate

pts = list(self.points())

Expand Down
2 changes: 1 addition & 1 deletion src/sage/crypto/lfsr.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@

import copy

from sage.structure.all import Sequence
from sage.structure.sequence import Sequence
from sage.rings.finite_rings.finite_field_base import FiniteField
from sage.rings.integer import Integer
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
Expand Down
2 changes: 1 addition & 1 deletion src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ from sage.rings.cc import CC
from sage.rings.real_double import RDF
from sage.rings.complex_double import CDF
from sage.ext.fast_callable import fast_callable
from sage.calculus.all import symbolic_expression
from sage.calculus.expr import symbolic_expression
from sage.symbolic.ring import SR
from sage.calculus.var import var
from sage.rings.fraction_field import FractionField_generic
Expand Down
3 changes: 2 additions & 1 deletion src/sage/geometry/cone.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@
from sage.modules.free_module_element import vector
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.structure.all import SageObject, parent
from sage.structure.sage_object import SageObject
from sage.structure.element import parent
from sage.structure.richcmp import richcmp_method, richcmp
lazy_import('sage.geometry.integral_points', 'parallelotope_points')
from sage.geometry.convex_set import ConvexSet_closed
Expand Down
3 changes: 2 additions & 1 deletion src/sage/geometry/hyperbolic_space/hyperbolic_isometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
from sage.rings.real_double import RDF
from sage.functions.other import imag
from sage.misc.functional import sqrt
from sage.functions.all import arccosh, sign
from sage.functions.hyperbolic import acosh as arccosh
from sage.functions.generalized import sgn as sign

from sage.geometry.hyperbolic_space.hyperbolic_constants import EPSILON
from sage.geometry.hyperbolic_space.hyperbolic_geodesic import HyperbolicGeodesic
Expand Down
2 changes: 1 addition & 1 deletion src/sage/geometry/hyperbolic_space/hyperbolic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
from sage.misc.lazy_import import lazy_import
from sage.functions.other import imag, real
from sage.misc.functional import sqrt
from sage.functions.all import arccosh
from sage.functions.hyperbolic import acosh as arccosh
from sage.rings.cc import CC
from sage.rings.real_double import RDF
from sage.rings.real_mpfr import RR
Expand Down
2 changes: 1 addition & 1 deletion src/sage/geometry/lattice_polytope.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.sets.set import Set_generic
from sage.structure.all import Sequence
from sage.structure.sequence import Sequence
from sage.structure.sage_object import SageObject
from sage.structure.richcmp import richcmp_method, richcmp
from sage.geometry.convex_set import ConvexSet_compact
Expand Down
2 changes: 1 addition & 1 deletion src/sage/geometry/toric_lattice.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
from sage.misc.lazy_import import lazy_import
lazy_import('sage.geometry.toric_plotter', 'ToricPlotter')
from sage.misc.latex import latex
from sage.structure.all import parent
from sage.structure.element import parent
from sage.structure.richcmp import (richcmp_method, richcmp, rich_to_bool,
richcmp_not_equal)
from sage.modules.fg_pid.fgp_element import FGP_Element
Expand Down
3 changes: 2 additions & 1 deletion src/sage/geometry/toric_plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,8 @@ def sector(ray1, ray2, **extra_options):
sage: sector((3,2,1), (1,2,3)) # needs sage.plot
Graphics3d Object
"""
from sage.functions.all import arccos, arctan2
from sage.functions.trig import acos as arccos
from sage.functions.trig import arctan2

ray1 = vector(RDF, ray1)
ray2 = vector(RDF, ray2)
Expand Down
Loading

0 comments on commit 3699e87

Please sign in to comment.