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

Commit

Permalink
src/sage/geometry: Remove remaining imports from sage.all, sage.{ring…
Browse files Browse the repository at this point in the history
…s,modules,misc,categories,matrix}.all
  • Loading branch information
Matthias Koeppe committed Sep 19, 2021
1 parent 2344514 commit b552ee8
Show file tree
Hide file tree
Showing 23 changed files with 85 additions and 42 deletions.
18 changes: 12 additions & 6 deletions src/sage/geometry/cone.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,16 @@
from sage.geometry.toric_plotter import ToricPlotter, label_list
from sage.geometry.relative_interior import RelativeInterior
from sage.graphs.digraph import DiGraph
from sage.matrix.all import column_matrix, matrix, MatrixSpace
from sage.matrix.constructor import matrix
from sage.matrix.matrix_space import MatrixSpace
from sage.matrix.special import column_matrix
from sage.misc.cachefunc import cached_method
from sage.misc.all import flatten, latex
from sage.modules.all import span, vector, VectorSpace
from sage.rings.all import QQ, ZZ
from sage.misc.flatten import flatten
from sage.misc.latex import latex
from sage.modules.free_module import span, VectorSpace
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.richcmp import richcmp_method, richcmp
from sage.geometry.integral_points import parallelotope_points
Expand Down Expand Up @@ -591,8 +596,6 @@ def _ambient_space_point(body, data):
(1.00000000000000, 3.14159265358979)
"""
from sage.rings.all import AA, RR

L = body.lattice()

def try_base_extend(ring):
Expand All @@ -617,6 +620,9 @@ def try_base_extend(ring):
# If we don't have a lattice element, try successively
# less-desirable ambient spaces until (as a last resort) we
# attempt a numerical representation.
from sage.rings.qqbar import AA
from sage.rings.real_mpfr import RR

for ring in [QQ, AA, RR]:
p = try_base_extend(ring)
if p is not None:
Expand Down
9 changes: 6 additions & 3 deletions src/sage/geometry/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,12 @@
from sage.graphs.digraph import DiGraph
from sage.matrix.constructor import matrix
from sage.misc.cachefunc import cached_method
from sage.misc.all import walltime, prod
from sage.modules.all import vector, span
from sage.rings.all import QQ, ZZ
from sage.misc.misc import walltime
from sage.misc.misc_c import prod
from sage.modules.free_module import span
from sage.modules.free_module_element import vector
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ


def is_Fan(x):
Expand Down
12 changes: 8 additions & 4 deletions src/sage/geometry/fan_morphism.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,20 @@

import operator

from sage.categories.all import Hom
from sage.categories.homset import Hom
from sage.geometry.cone import Cone
from sage.geometry.fan import Fan, is_Fan
from sage.matrix.all import identity_matrix, matrix
from sage.matrix.constructor import matrix
from sage.matrix.special import identity_matrix
from sage.structure.element import is_Matrix
from sage.misc.cachefunc import cached_method
from sage.misc.all import latex, prod, walltime
from sage.misc.latex import latex
from sage.misc.misc import walltime
from sage.misc.misc_c import prod
from sage.modules.free_module_morphism import (FreeModuleMorphism,
is_FreeModuleMorphism)
from sage.rings.all import Infinity, ZZ
from sage.rings.infinity import Infinity
from sage.rings.integer_ring import ZZ
from sage.rings.infinity import is_Infinite
from functools import reduce

Expand Down
3 changes: 2 additions & 1 deletion src/sage/geometry/hyperbolic_space/hyperbolic_geodesic.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@
from sage.symbolic.constants import I
from sage.misc.lazy_attribute import lazy_attribute
from sage.rings.infinity import infinity
from sage.rings.all import CC, RR
from sage.rings.all import CC
from sage.rings.real_mpfr import RR
from sage.plot.arc import arc
from sage.plot.line import line
from sage.symbolic.constants import pi
Expand Down
4 changes: 3 additions & 1 deletion src/sage/geometry/hyperbolic_space/hyperbolic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@
from sage.misc.lazy_import import lazy_import
from sage.functions.other import imag, real, sqrt
from sage.functions.all import arccosh
from sage.rings.all import CC, RR, RDF
from sage.rings.all import CC
from sage.rings.real_double import RDF
from sage.rings.real_mpfr import RR
from sage.rings.infinity import infinity
from sage.symbolic.constants import I
from sage.matrix.constructor import matrix
Expand Down
3 changes: 2 additions & 1 deletion src/sage/geometry/hyperbolic_space/hyperbolic_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
from sage.matrix.constructor import matrix
from sage.modules.free_module_element import vector
from sage.rings.infinity import infinity
from sage.rings.all import RR, CC
from sage.rings.all import CC
from sage.rings.real_mpfr import RR
from sage.functions.other import real, imag

from sage.geometry.hyperbolic_space.hyperbolic_isometry import HyperbolicIsometry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def __init__(self, p, V):
(0, 0, 0, 0)
"""
R = V.base_ring()
from sage.categories.all import Fields
from sage.categories.fields import Fields
if R not in Fields():
R = R.fraction_field()
V = V.change_ring(R)
Expand Down
7 changes: 4 additions & 3 deletions src/sage/geometry/hyperplane_arrangement/arrangement.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,8 @@
from sage.structure.element import Element
from sage.structure.richcmp import richcmp
from sage.structure.unique_representation import UniqueRepresentation
from sage.rings.all import QQ, ZZ
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.misc.cachefunc import cached_method
from sage.matrix.constructor import matrix, vector
from sage.modules.free_module import VectorSpace
Expand Down Expand Up @@ -1240,7 +1241,7 @@ def has_good_reduction(self, p):
raise TypeError('arrangement must be defined over QQ')
if not p.is_prime():
raise TypeError('must reduce modulo a prime number')
from sage.rings.all import GF
from sage.rings.finite_rings.finite_field_constructor import GF
a = self.change_ring(GF(p))
p = self.intersection_poset()
q = a.intersection_poset()
Expand Down Expand Up @@ -3402,7 +3403,7 @@ def __init__(self, base_ring, names=tuple()):
sage: K = HyperplaneArrangements(QQ)
sage: TestSuite(K).run()
"""
from sage.categories.all import Sets
from sage.categories.sets_cat import Sets
from sage.rings.ring import _Fields
if base_ring not in _Fields:
raise ValueError('base ring must be a field')
Expand Down
4 changes: 3 additions & 1 deletion src/sage/geometry/hyperplane_arrangement/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@

from sage.graphs.all import graphs
from sage.matrix.constructor import matrix, random_matrix
from sage.rings.all import QQ, ZZ, NN
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.rings.semirings.non_negative_integer_semiring import NN
from sage.misc.misc_c import prod

from sage.combinat.combinat import stirling_number2
Expand Down
4 changes: 3 additions & 1 deletion src/sage/geometry/integral_points.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import copy
import itertools

from sage.matrix.constructor import matrix, column_matrix, vector, diagonal_matrix
from sage.rings.all import QQ, RR, ZZ
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.rings.real_mpfr import RR
from sage.rings.integer cimport Integer
from sage.arith.all import gcd, lcm
from sage.combinat.permutation import Permutation
Expand Down
7 changes: 5 additions & 2 deletions src/sage/geometry/lattice_polytope.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,16 @@
from sage.matrix.constructor import matrix
from sage.structure.element import is_Matrix
from sage.misc.cachefunc import cached_method
from sage.misc.all import flatten, tmp_filename
from sage.misc.flatten import flatten
from sage.misc.temporary_file import tmp_filename
from sage.modules.free_module_element import vector
from sage.numerical.mip import MixedIntegerLinearProgram
from sage.plot.plot3d.index_face_set import IndexFaceSet
from sage.plot.plot3d.all import line3d, point3d
from sage.plot.plot3d.shapes2 import text3d
from sage.rings.all import Integer, ZZ, QQ
from sage.rings.integer import Integer
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.sage_object import SageObject
Expand Down
4 changes: 2 additions & 2 deletions src/sage/geometry/linear_expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ def ambient_module(self):
sage: M.ambient_vector_space()
Vector space of dimension 2 over Rational Field
"""
from sage.modules.all import FreeModule
from sage.modules.free_module import FreeModule
return FreeModule(self.base_ring(), self.ngens())

@cached_method
Expand Down Expand Up @@ -714,7 +714,7 @@ def ambient_vector_space(self):
sage: M.ambient_vector_space()
Vector space of dimension 2 over Rational Field
"""
from sage.modules.all import VectorSpace
from sage.modules.free_module import VectorSpace
field = self.base_ring().fraction_field()
return VectorSpace(field, self.ngens())

Expand Down
3 changes: 2 additions & 1 deletion src/sage/geometry/polyhedron/backend_normaliz.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
lazy_import('PyNormaliz', ['NmzResult', 'NmzCompute', 'NmzCone', 'NmzConeCopy'],
feature=PythonModule("PyNormaliz", spkg="pynormaliz"))

from sage.rings.all import ZZ, QQ
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.arith.functions import LCM_list
from sage.misc.functional import denominator
from sage.matrix.constructor import vector
Expand Down
9 changes: 5 additions & 4 deletions src/sage/geometry/polyhedron/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
from sage.misc.randstate import current_randstate
from sage.misc.superseded import deprecated_function_alias

from sage.rings.all import QQ, ZZ, AA
from sage.rings.integer_ring import ZZ
from sage.rings.qqbar import AA
from sage.rings.rational_field import QQ
from sage.rings.real_double import RDF
from sage.modules.free_module_element import vector
from sage.modules.vector_space_morphism import linear_transformation
Expand Down Expand Up @@ -671,9 +673,8 @@ def change_ring(self, base_ring, backend=None):
A 0-dimensional polyhedron in RDF^2 defined as the convex hull of 1 vertex
sage: P.n_vertices() == Q.n_vertices()
False
"""

from sage.categories.all import Rings
"""
from sage.categories.rings import Rings

if base_ring not in Rings:
raise ValueError("invalid base ring")
Expand Down
3 changes: 2 additions & 1 deletion src/sage/geometry/polyhedron/base_ZZ.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.rings.all import ZZ, QQ
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.misc.cachefunc import cached_method
from sage.modules.free_module_element import vector
from .base_QQ import Polyhedron_QQ
Expand Down
7 changes: 5 additions & 2 deletions src/sage/geometry/polyhedron/constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,9 @@
# https://www.gnu.org/licenses/
########################################################################

from sage.rings.all import ZZ, RDF, RR
from sage.rings.integer_ring import ZZ
from sage.rings.real_double import RDF
from sage.rings.real_mpfr import RR

from .misc import _make_listlist, _common_length_of

Expand Down Expand Up @@ -615,7 +617,8 @@ def Polyhedron(vertices=None, rays=None, lines=None,
# figure out base_ring
from sage.misc.flatten import flatten
from sage.structure.element import parent
from sage.categories.all import Rings, Fields
from sage.categories.fields import Fields
from sage.categories.rings import Rings

values = flatten(vertices + rays + lines + ieqs + eqns)
if base_ring is not None:
Expand Down
8 changes: 6 additions & 2 deletions src/sage/geometry/polyhedron/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@

import itertools

from sage.rings.all import ZZ, QQ, RDF, RR, AA, QQbar
from sage.rings.integer_ring import ZZ
from sage.rings.qqbar import AA, QQbar
from sage.rings.rational_field import QQ
from sage.rings.real_double import RDF
from sage.rings.real_mpfr import RR
from sage.combinat.permutation import Permutations
from sage.groups.perm_gps.permgroup_named import AlternatingGroup
from .constructor import Polyhedron
Expand Down Expand Up @@ -440,7 +444,7 @@ def gale_transform_to_primal(vectors, base_ring=None, backend=None):
ValueError: input vectors not totally cyclic
"""
from sage.modules.free_module_element import vector
from sage.matrix.all import Matrix
from sage.matrix.constructor import Matrix
if base_ring:
vectors = tuple(vector(base_ring, x) for x in vectors)
else:
Expand Down
5 changes: 4 additions & 1 deletion src/sage/geometry/polyhedron/parent.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
from sage.structure.unique_representation import UniqueRepresentation
from sage.modules.free_module import FreeModule, is_FreeModule
from sage.misc.cachefunc import cached_method, cached_function
from sage.rings.all import ZZ, QQ, RDF, CommutativeRing
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.rings.real_double import RDF
from sage.rings.ring import CommutativeRing
from sage.categories.fields import Fields
from sage.categories.rings import Rings
from sage.categories.modules import Modules
Expand Down
2 changes: 1 addition & 1 deletion src/sage/geometry/polyhedron/ppl_lattice_polygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

from sage.rings.integer_ring import ZZ
from sage.misc.cachefunc import cached_method, cached_function
from sage.modules.all import (vector, zero_vector)
from sage.modules.free_module_element import vector, zero_vector
from sage.matrix.constructor import (matrix, zero_matrix, block_matrix)
from ppl import C_Polyhedron, Poly_Con_Relation
from sage.geometry.polyhedron.lattice_euclidean_group_element import (
Expand Down
3 changes: 2 additions & 1 deletion src/sage/geometry/toric_lattice.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@
FreeModule_generic_pid,
FreeModule_submodule_pid,
FreeModule_submodule_with_basis_pid)
from sage.rings.all import QQ, ZZ
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.structure.factory import UniqueFactory


Expand Down
3 changes: 2 additions & 1 deletion src/sage/geometry/triangulation/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@

from sage.structure.richcmp import richcmp
from sage.structure.element import Element
from sage.rings.all import QQ, ZZ
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.modules.free_module_element import vector
from sage.misc.cachefunc import cached_method
from sage.sets.set import Set
Expand Down
3 changes: 2 additions & 1 deletion src/sage/geometry/triangulation/point_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@
from sage.misc.cachefunc import cached_method

from sage.combinat.combination import Combinations
from sage.rings.all import QQ, ZZ
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.matrix.constructor import matrix
from sage.modules.free_module_element import vector

Expand Down
4 changes: 3 additions & 1 deletion src/sage/geometry/voronoi_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@

from sage.structure.sage_object import SageObject
from sage.geometry.polyhedron.constructor import Polyhedron
from sage.all import RDF, QQ, AA
from sage.rings.qqbar import AA
from sage.rings.rational_field import QQ
from sage.rings.real_double import RDF
from sage.rings.real_mpfr import RealField_class
from sage.geometry.triangulation.point_configuration import PointConfiguration
from sage.modules.free_module_element import vector
Expand Down

0 comments on commit b552ee8

Please sign in to comment.