Skip to content

Commit

Permalink
Trac #32591: Remove some .all imports
Browse files Browse the repository at this point in the history
(cherry-picked from #32432)

URL: https://trac.sagemath.org/32591
Reported by: mkoeppe
Ticket author(s): Matthias Koeppe
Reviewer(s): Travis Scrimshaw
  • Loading branch information
Release Manager committed Oct 12, 2021
2 parents f4d99de + 5f1c296 commit 9b9b57f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/sage/misc/sage_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ def _test_pickling(self, **options):
:func:`dumps`, :func:`loads`
"""
tester = instance_tester(self, **options)
from sage.misc.all import loads, dumps
from sage.misc.persist import loads, dumps
tester.assertEqual(loads(dumps(self._instance)), self._instance)

def _test_new(self, **options):
Expand Down
4 changes: 3 additions & 1 deletion src/sage/modules/fg_pid/fgp_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,9 @@ def additive_order(self):
I = Q.invariants()
v = self.vector()

from sage.rings.all import infinity, Mod, Integer
from sage.rings.infinity import infinity
from sage.rings.finite_rings.integer_mod import Mod
from sage.rings.integer import Integer
from sage.arith.all import lcm
n = Integer(1)
for i, a in enumerate(I):
Expand Down
9 changes: 5 additions & 4 deletions src/sage/modules/fg_pid/fgp_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,9 @@
from sage.structure.sequence import Sequence
from .fgp_element import DEBUG, FGP_Element
from .fgp_morphism import FGP_Morphism, FGP_Homset
from sage.rings.all import Integer, ZZ
from sage.arith.all import lcm
from sage.rings.integer_ring import ZZ
from sage.rings.integer import Integer
from sage.arith.functions import lcm
from sage.misc.cachefunc import cached_method
from sage.matrix.constructor import matrix

Expand Down Expand Up @@ -1223,7 +1224,7 @@ def gens_vector(self, x, reduce=False):
"""
x = self(x)
v = x.vector() * self.smith_to_gens()
from sage.rings.all import infinity
from sage.rings.infinity import infinity
if reduce and self.base_ring() == ZZ:
orders = [g.order() for g in self.gens()]
v = v.parent()([v[i] if orders[i] == infinity
Expand Down Expand Up @@ -1740,7 +1741,7 @@ def cardinality(self):
return self.__cardinality
except AttributeError:
pass
from sage.rings.all import infinity
from sage.rings.infinity import infinity
from sage.misc.misc_c import prod
v = self.invariants()
self.__cardinality = infinity if 0 in v else prod(v)
Expand Down
4 changes: 2 additions & 2 deletions src/sage/modules/fg_pid/fgp_morphism.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,10 +507,10 @@ def __init__(self, X, Y, category=None):
if category is None:
from sage.modules.free_module import is_FreeModule
if is_FreeModule(X) and is_FreeModule(Y):
from sage.all import FreeModules
from sage.categories.all import FreeModules
category = FreeModules(X.base_ring())
else:
from sage.all import Modules
from sage.categories.all import Modules
category = Modules(X.base_ring())
Homset.__init__(self, X, Y, category)

Expand Down
2 changes: 1 addition & 1 deletion src/sage/structure/sage_object.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ cdef class SageObject:
remote Sage session, and get it back.
"""
tester = self._tester(**options)
from sage.misc.all import loads, dumps
from sage.misc.persist import loads, dumps
tester.assertEqual(loads(dumps(self)), self)

#############################################################################
Expand Down

0 comments on commit 9b9b57f

Please sign in to comment.