Skip to content

Commit cf49215

Browse files
author
Release Manager
committed
gh-35012: Issue #34949: sage.{categories,matrix,structure}: Replace imports from sage.*.all for namespace packages Closes #34949 URL: #35012 Reported by: Matthias Köppe Reviewer(s): Tobias Diez
2 parents c6508c5 + d905cc3 commit cf49215

Some content is hidden

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

61 files changed

+188
-153
lines changed

src/sage/arith/long.pxd

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# sage.doctest: optional - sage.misc.cython
12
r"""
23
Fast conversion of Python objects to C long
34
"""
@@ -113,7 +114,7 @@ cdef inline bint integer_check_long(x, long* value, int* err) except -1:
113114
114115
We create a pure Python wrapper of this function::
115116
116-
sage: cython(''' # optional - sage.misc.cython
117+
sage: cython('''
117118
....: from sage.arith.long cimport *
118119
....: from sage.rings.integer cimport smallInteger
119120
....: def check_long(x):
@@ -246,7 +247,7 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
246247
247248
We create a pure Python wrapper of this function::
248249
249-
sage: cython(''' # optional - sage.misc.cython
250+
sage: cython('''
250251
....: from sage.arith.long cimport *
251252
....: def check_long_py(x):
252253
....: cdef long value
@@ -387,7 +388,7 @@ cdef inline bint is_small_python_int(obj):
387388
388389
EXAMPLES::
389390
390-
sage: cython(''' # optional - sage.misc.cython
391+
sage: cython('''
391392
....: from sage.arith.long cimport is_small_python_int
392393
....: def is_small_wrapper(x):
393394
....: return is_small_python_int(x)

src/sage/categories/bialgebras.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
# *****************************************************************************
1111

1212
from sage.categories.category_types import Category_over_base_ring
13-
from sage.categories.all import Algebras, Coalgebras
13+
from sage.categories.algebras import Algebras
14+
from sage.categories.coalgebras import Coalgebras
1415
from sage.categories.super_modules import SuperModulesCategory
1516
from sage.misc.lazy_import import LazyImport
1617

src/sage/categories/category.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class Category(UniqueRepresentation, SageObject):
153153
154154
This is achieved as follows::
155155
156-
sage: from sage.categories.all import Category
156+
sage: from sage.categories.category import Category
157157
sage: class EuclideanDomains(Category):
158158
....: # operations on the category itself
159159
....: def super_categories(self):
@@ -201,7 +201,7 @@ class inheritance from ``C.parent_class``.
201201
202202
::
203203
204-
sage: from sage.categories.all import Category
204+
sage: from sage.categories.category import Category
205205
sage: from sage.misc.lazy_attribute import lazy_attribute
206206
sage: class As (Category):
207207
....: def super_categories(self):

src/sage/categories/chain_complexes.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ def super_categories(self):
4646
[Category of modules over Ring of integers modulo 9]
4747
4848
"""
49-
from sage.categories.all import Fields, Modules, VectorSpaces
49+
from sage.categories.fields import Fields
50+
from sage.categories.modules import Modules
51+
from sage.categories.vector_spaces import VectorSpaces
5052
base_ring = self.base_ring()
5153
if base_ring in Fields():
5254
return [VectorSpaces(base_ring)]

src/sage/categories/coalgebras.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# *****************************************************************************
1111

1212
from .category_types import Category_over_base_ring
13-
from sage.categories.all import Modules
13+
from sage.categories.modules import Modules
1414
from sage.categories.category_with_axiom import CategoryWithAxiom_over_base_ring
1515
from sage.categories.tensor import TensorProductsCategory
1616
from sage.categories.dual import DualObjectsCategory

src/sage/categories/coalgebras_with_basis.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
from sage.misc.lazy_attribute import lazy_attribute
1414
from sage.misc.lazy_import import LazyImport
1515
from sage.categories.category_with_axiom import CategoryWithAxiom_over_base_ring
16-
from sage.categories.all import ModulesWithBasis, tensor, Hom
16+
from sage.categories.modules_with_basis import ModulesWithBasis
17+
from sage.categories.tensor import tensor
18+
from sage.categories.homset import Hom
1719
from sage.categories.super_modules import SuperModulesCategory
1820
from sage.categories.filtered_modules import FilteredModulesCategory
1921

src/sage/categories/examples/algebras_with_basis.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from sage.misc.cachefunc import cached_method
1212
from sage.sets.family import Family
13-
from sage.categories.all import AlgebrasWithBasis
13+
from sage.categories.algebras_with_basis import AlgebrasWithBasis
1414
from sage.combinat.free_module import CombinatorialFreeModule
1515
from sage.combinat.words.words import Words
1616

src/sage/categories/examples/commutative_additive_monoids.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from sage.misc.cachefunc import cached_method
1212
from sage.structure.parent import Parent
13-
from sage.categories.all import CommutativeAdditiveMonoids
13+
from sage.categories.commutative_additive_monoids import CommutativeAdditiveMonoids
1414
from .commutative_additive_semigroups import FreeCommutativeAdditiveSemigroup
1515

1616
class FreeCommutativeAdditiveMonoid(FreeCommutativeAdditiveSemigroup):

src/sage/categories/examples/commutative_additive_semigroups.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from sage.structure.parent import Parent
1313
from sage.structure.element_wrapper import ElementWrapper
1414
from sage.structure.unique_representation import UniqueRepresentation
15-
from sage.categories.all import CommutativeAdditiveSemigroups
15+
from sage.categories.commutative_additive_semigroups import CommutativeAdditiveSemigroups
1616
from sage.sets.family import Family
1717

1818
class FreeCommutativeAdditiveSemigroup(UniqueRepresentation, Parent):

src/sage/categories/examples/finite_coxeter_groups.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from sage.misc.cachefunc import cached_method
1212
from sage.structure.parent import Parent
1313
from sage.structure.element_wrapper import ElementWrapper
14-
from sage.categories.all import FiniteCoxeterGroups
14+
from sage.categories.finite_coxeter_groups import FiniteCoxeterGroups
1515
from sage.structure.unique_representation import UniqueRepresentation
1616
from sage.misc.functional import is_odd, is_even
1717
from sage.combinat.root_system.coxeter_matrix import CoxeterMatrix

src/sage/categories/examples/finite_dimensional_algebras_with_basis.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#*****************************************************************************
1010

1111
from sage.misc.cachefunc import cached_method
12-
from sage.categories.all import FiniteDimensionalAlgebrasWithBasis
12+
from sage.categories.finite_dimensional_algebras_with_basis import FiniteDimensionalAlgebrasWithBasis
1313
from sage.combinat.free_module import CombinatorialFreeModule
1414

1515

src/sage/categories/examples/finite_dimensional_lie_algebras_with_basis.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from sage.misc.cachefunc import cached_method
1212
from sage.sets.family import Family
13-
from sage.categories.all import LieAlgebras
13+
from sage.categories.lie_algebras import LieAlgebras
1414
from sage.modules.free_module import FreeModule
1515
from sage.structure.parent import Parent
1616
from sage.structure.unique_representation import UniqueRepresentation

src/sage/categories/examples/finite_monoids.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from sage.structure.parent import Parent
1414
from sage.structure.unique_representation import UniqueRepresentation
1515
from sage.structure.element_wrapper import ElementWrapper
16-
from sage.categories.all import Monoids
16+
from sage.categories.monoids import Monoids
1717
from sage.rings.integer import Integer
1818
from sage.rings.integer_ring import ZZ
1919

src/sage/categories/examples/finite_weyl_groups.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from sage.misc.cachefunc import cached_method
1212
from sage.structure.parent import Parent
1313
from sage.structure.element_wrapper import ElementWrapper
14-
from sage.categories.all import FiniteWeylGroups
14+
from sage.categories.finite_weyl_groups import FiniteWeylGroups
1515
from sage.structure.unique_representation import UniqueRepresentation
1616

1717
class SymmetricGroup(UniqueRepresentation, Parent):

src/sage/categories/examples/hopf_algebras_with_basis.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
from sage.misc.cachefunc import cached_method
1212
from sage.sets.family import Family
13-
from sage.categories.all import HopfAlgebrasWithBasis
13+
from sage.categories.hopf_algebras_with_basis import HopfAlgebrasWithBasis
1414
from sage.combinat.free_module import CombinatorialFreeModule
15-
from sage.categories.all import tensor
15+
from sage.categories.tensor import tensor
1616

1717
class MyGroupAlgebra(CombinatorialFreeModule):
1818
r"""

src/sage/categories/examples/lie_algebras.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#from sage.misc.cachefunc import cached_method
1212
from sage.sets.family import Family
13-
from sage.categories.all import LieAlgebras
13+
from sage.categories.lie_algebras import LieAlgebras
1414
from sage.structure.parent import Parent
1515
from sage.structure.unique_representation import UniqueRepresentation
1616
from sage.structure.element_wrapper import ElementWrapper

src/sage/categories/examples/magmas.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from sage.structure.parent import Parent
1616
from sage.structure.unique_representation import UniqueRepresentation
1717
from sage.structure.element_wrapper import ElementWrapper
18-
from sage.categories.all import Magmas
18+
from sage.categories.magmas import Magmas
1919
from sage.sets.family import Family
2020

2121

src/sage/categories/examples/monoids.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from sage.misc.cachefunc import cached_method
1212
from sage.structure.parent import Parent
1313
from sage.structure.element_wrapper import ElementWrapper
14-
from sage.categories.all import Monoids
14+
from sage.categories.monoids import Monoids
1515
from .semigroups import FreeSemigroup
1616
from sage.sets.family import Family
1717

src/sage/categories/examples/posets.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from sage.structure.parent import Parent
1212
from sage.structure.unique_representation import UniqueRepresentation
13-
from sage.categories.all import Posets
13+
from sage.categories.posets import Posets
1414
from sage.structure.element_wrapper import ElementWrapper
1515
from sage.sets.set import Set, Set_object_enumerated
1616
from sage.sets.positive_integers import PositiveIntegers

src/sage/categories/examples/semigroups.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from sage.structure.parent import Parent
1313
from sage.structure.unique_representation import UniqueRepresentation
1414
from sage.structure.element_wrapper import ElementWrapper
15-
from sage.categories.all import Semigroups
15+
from sage.categories.semigroups import Semigroups
1616
from sage.sets.family import Family
1717

1818
class LeftZeroSemigroup(UniqueRepresentation, Parent):

src/sage/categories/examples/semigroups_cython.pyx

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ Examples of semigroups in cython
44

55
from sage.structure.parent cimport Parent
66
from sage.structure.element cimport Element
7-
from sage.categories.all import Category, Semigroups
7+
from sage.categories.category import Category
8+
from sage.categories.semigroups import Semigroups
89
from sage.categories.examples.semigroups import LeftZeroSemigroup as LeftZeroSemigroupPython
910
from cpython.object cimport PyObject_RichCompare
1011

src/sage/categories/examples/sets_cat.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from sage.categories.sets_cat import Sets
1414
from sage.rings.integer import Integer, IntegerWrapper
1515
from sage.rings.integer_ring import IntegerRing
16-
from sage.arith.all import is_prime
16+
from sage.arith.misc import is_prime
1717
from sage.structure.unique_representation import UniqueRepresentation
1818

1919

src/sage/categories/examples/with_realizations.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
from sage.misc.cachefunc import cached_method
1212
from sage.misc.bindable_class import BindableClass
13-
from sage.categories.all import Rings, Algebras, AlgebrasWithBasis
13+
from sage.categories.rings import Rings
14+
from sage.categories.algebras import Algebras
15+
from sage.categories.algebras_with_basis import AlgebrasWithBasis
1416
from sage.categories.realizations import Category_realization_of_parent
1517
from sage.structure.unique_representation import UniqueRepresentation
1618
from sage.structure.parent import Parent

src/sage/categories/finite_complex_reflection_groups.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ def base_change_matrix(self):
523523
[ 1 0]
524524
[E(4) 1]
525525
"""
526-
from sage.matrix.all import Matrix
526+
from sage.matrix.constructor import Matrix
527527
return Matrix(list(self.independent_roots())).inverse()
528528

529529
class ElementMethods:
@@ -1187,7 +1187,7 @@ def rational_catalan_number(self, p, polynomial=False):
11871187
sage: W.rational_catalan_number(3, polynomial=True)
11881188
q^6 + q^4 + q^3 + q^2 + 1
11891189
"""
1190-
from sage.arith.all import gcd
1190+
from sage.arith.misc import GCD as gcd
11911191
from sage.combinat.q_analogues import q_int
11921192

11931193
h = self.coxeter_number()

src/sage/categories/finite_dimensional_bialgebras_with_basis.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ def FiniteDimensionalBialgebrasWithBasis(base_ring):
2727
2828
sage: TestSuite(C).run()
2929
"""
30-
from sage.categories.all import BialgebrasWithBasis
30+
from sage.categories.bialgebras_with_basis import BialgebrasWithBasis
3131
return BialgebrasWithBasis(base_ring).FiniteDimensional()

src/sage/categories/finite_dimensional_coalgebras_with_basis.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ def FiniteDimensionalCoalgebrasWithBasis(base_ring):
2727
2828
sage: TestSuite(C).run()
2929
"""
30-
from sage.categories.all import CoalgebrasWithBasis
30+
from sage.categories.coalgebras_with_basis import CoalgebrasWithBasis
3131
return CoalgebrasWithBasis(base_ring).FiniteDimensional()

src/sage/categories/graded_bialgebras.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ def GradedBialgebras(base_ring):
2626
2727
sage: TestSuite(C).run()
2828
"""
29-
from sage.categories.all import Bialgebras
29+
from sage.categories.bialgebras import Bialgebras
3030
return Bialgebras(base_ring).Graded()

src/sage/categories/graded_bialgebras_with_basis.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ def GradedBialgebrasWithBasis(base_ring):
2626
2727
sage: TestSuite(C).run()
2828
"""
29-
from sage.categories.all import BialgebrasWithBasis
29+
from sage.categories.bialgebras_with_basis import BialgebrasWithBasis
3030
return BialgebrasWithBasis(base_ring).Graded()

src/sage/categories/graded_hopf_algebras.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ def GradedHopfAlgebras(base_ring):
3535
:class:`super Hopf algebras
3636
<sage.categories.hopf_algebras.HopfAlgebras.Super>`.
3737
"""
38-
from sage.categories.all import HopfAlgebras
38+
from sage.categories.hopf_algebras import HopfAlgebras
3939
return HopfAlgebras(base_ring).Graded()

src/sage/categories/map.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,7 @@ cdef class Section(Map):
13311331
To: Multivariate Polynomial Ring in x, y over Rational Field
13321332
"""
13331333
from sage.categories.homset import Hom
1334-
from sage.categories.all import SetsWithPartialMaps
1334+
from sage.categories.sets_with_partial_maps import SetsWithPartialMaps
13351335
Map.__init__(self, Hom(map.codomain(), map.domain(), SetsWithPartialMaps()))
13361336
self._inverse = map # TODO: Use this attribute somewhere!
13371337

src/sage/categories/monoid_algebras.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ def MonoidAlgebras(base_ring):
3333
3434
sage: TestSuite(MonoidAlgebras(ZZ)).run()
3535
"""
36-
from sage.categories.all import Monoids
36+
from sage.categories.monoids import Monoids
3737
return Monoids().Algebras(base_ring)

src/sage/categories/schemes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def _call_(self, x):
140140
from sage.categories.commutative_rings import CommutativeRings
141141
from sage.schemes.generic.spec import Spec
142142
from sage.categories.map import Map
143-
from sage.categories.all import Rings
143+
from sage.categories.rings import Rings
144144
if x in CommutativeRings():
145145
return Spec(x)
146146
elif isinstance(x, Map) and x.category_for().is_subcategory(Rings()):

src/sage/cpython/cython_metaclass.pyx

+6-4
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ In Python, this would be ``meta.__init__(cls, name, bases, dict)``.
6161
6262
EXAMPLES::
6363
64-
sage: cython(''' # optional - sage.misc.cython
64+
sage: cython( # optional - sage.misc.cython
65+
....: '''
6566
....: cimport sage.cpython.cython_metaclass
6667
....: cdef class MyCustomType():
6768
....: def __getmetaclass__(_):
@@ -75,9 +76,9 @@ EXAMPLES::
7576
....: ''')
7677
Calling MyMetaclass.__init__(<class '...MyCustomType'>, None, None, None)
7778
Calling MyMetaclass.__init__(<class '...MyDerivedType'>, None, None, None)
78-
sage: MyCustomType.__class__
79+
sage: MyCustomType.__class__ # optional - sage.misc.cython
7980
<class '...MyMetaclass'>
80-
sage: class MyPythonType(MyDerivedType):
81+
sage: class MyPythonType(MyDerivedType): # optional - sage.misc.cython
8182
....: pass
8283
Calling MyMetaclass.__init__(<class '...MyPythonType'>, 'MyPythonType', (<class '...MyDerivedType'>,), {...})
8384
@@ -98,7 +99,8 @@ TESTS:
9899
Check that a proper exception is raised if ``__getmetaclass__``
99100
returns a non-type::
100101
101-
sage: cython(''' # optional - sage.misc.cython
102+
sage: cython( # optional - sage.misc.cython
103+
....: '''
102104
....: cimport sage.cpython.cython_metaclass
103105
....: cdef class MyCustomType():
104106
....: def __getmetaclass__(_):

src/sage/cpython/string.pyx

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ TESTS:
66
77
Check that this can be used outside of Sage (see :trac:`25549`)::
88
9-
sage: cython(''' # optional - sage.misc.cython
9+
sage: cython( # optional - sage.misc.cython
10+
....: '''
1011
....: from sage.cpython.string cimport char_to_str
1112
....: print(char_to_str("hello world!"))
1213
....: ''')

0 commit comments

Comments
 (0)