From 9eab4588e5235fc887089f93184769e01401d977 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 29 Oct 2023 16:25:53 +0000 Subject: [PATCH 1/2] Replace relative imports by absolute ones in categories --- src/sage/categories/action.pxd | 6 +- src/sage/categories/action.pyx | 8 +- src/sage/categories/algebra_ideals.py | 8 +- src/sage/categories/algebra_modules.py | 9 +- src/sage/categories/algebras_with_basis.py | 8 +- src/sage/categories/all.py | 99 ++----------------- src/sage/categories/all__sagemath_objects.py | 15 --- src/sage/categories/basic.py | 37 ++----- src/sage/categories/category_singleton.pyx | 2 + src/sage/categories/category_types.py | 6 +- src/sage/categories/chain_complexes.py | 9 +- src/sage/categories/coalgebras.py | 8 +- .../categories/commutative_algebra_ideals.py | 8 +- .../categories/commutative_ring_ideals.py | 5 +- .../categories/complete_discrete_valuation.py | 7 +- ...ensional_semisimple_algebras_with_basis.py | 5 +- src/sage/categories/functor.pyx | 2 +- src/sage/categories/g_sets.py | 3 +- src/sage/categories/groupoid.py | 3 +- src/sage/categories/homset.py | 10 +- src/sage/categories/hopf_algebras.py | 8 +- src/sage/categories/l_trivial_semigroups.py | 5 +- .../categories/lambda_bracket_algebras.py | 11 ++- src/sage/categories/left_modules.py | 3 +- src/sage/categories/lie_conformal_algebras.py | 12 ++- src/sage/categories/map.pyx | 2 +- src/sage/categories/matrix_algebras.py | 5 +- .../categories/modular_abelian_varieties.py | 11 ++- src/sage/categories/modules.py | 25 ++--- src/sage/categories/morphism.pxd | 2 +- src/sage/categories/pointed_sets.py | 3 +- src/sage/categories/pushout.py | 18 ++-- src/sage/categories/r_trivial_semigroups.py | 3 +- src/sage/categories/right_modules.py | 3 +- src/sage/categories/ring_ideals.py | 5 +- src/sage/categories/semirings.py | 3 +- src/sage/categories/semisimple_algebras.py | 7 +- src/sage/categories/sets_with_grading.py | 12 +-- src/sage/categories/sets_with_partial_maps.py | 2 +- 39 files changed, 155 insertions(+), 243 deletions(-) diff --git a/src/sage/categories/action.pxd b/src/sage/categories/action.pxd index 0c9e322d455..5883adebc97 100644 --- a/src/sage/categories/action.pxd +++ b/src/sage/categories/action.pxd @@ -1,7 +1,7 @@ from sage.structure.element cimport Element -from .morphism cimport Morphism -from .map cimport Map -from .functor cimport Functor +from sage.categories.morphism cimport Morphism +from sage.categories.map cimport Map +from sage.categories.functor cimport Functor cdef class Action(Functor): cdef readonly G diff --git a/src/sage/categories/action.pyx b/src/sage/categories/action.pyx index b3244f766d4..0d564e46c4d 100644 --- a/src/sage/categories/action.pyx +++ b/src/sage/categories/action.pyx @@ -56,13 +56,13 @@ AUTHOR: from cpython.tuple cimport PyTuple_GET_ITEM -from .functor cimport Functor -from .morphism cimport Morphism -from .map cimport Map +from sage.categories.functor cimport Functor +from sage.categories.morphism cimport Morphism +from sage.categories.map cimport Map from sage.structure.element cimport parent from sage.structure.parent cimport Parent -from . import homset +from sage.categories import homset from weakref import ref diff --git a/src/sage/categories/algebra_ideals.py b/src/sage/categories/algebra_ideals.py index 1d6e3775e7b..c33fa0ef7b0 100644 --- a/src/sage/categories/algebra_ideals.py +++ b/src/sage/categories/algebra_ideals.py @@ -10,10 +10,10 @@ # https://www.gnu.org/licenses/ # ***************************************************************************** -from .algebra_modules import AlgebraModules -from .algebras import Algebras -from .rings import Rings -from .category_types import Category_ideal +from sage.categories.algebra_modules import AlgebraModules +from sage.categories.algebras import Algebras +from sage.categories.category_types import Category_ideal +from sage.categories.rings import Rings class AlgebraIdeals(Category_ideal): diff --git a/src/sage/categories/algebra_modules.py b/src/sage/categories/algebra_modules.py index 7be7de2c471..e827cc7130d 100644 --- a/src/sage/categories/algebra_modules.py +++ b/src/sage/categories/algebra_modules.py @@ -10,10 +10,11 @@ # http://www.gnu.org/licenses/ #****************************************************************************** -from .category_types import Category_module -from .commutative_algebras import CommutativeAlgebras -from .commutative_rings import CommutativeRings -from .modules import Modules +from sage.categories.category_types import Category_module +from sage.categories.commutative_algebras import CommutativeAlgebras +from sage.categories.commutative_rings import CommutativeRings +from sage.categories.modules import Modules + class AlgebraModules(Category_module): """ diff --git a/src/sage/categories/algebras_with_basis.py b/src/sage/categories/algebras_with_basis.py index 28177a1ff45..dfd693a9520 100644 --- a/src/sage/categories/algebras_with_basis.py +++ b/src/sage/categories/algebras_with_basis.py @@ -9,13 +9,13 @@ # https://www.gnu.org/licenses/ #****************************************************************************** +from sage.categories.cartesian_product import CartesianProductsCategory +from sage.categories.category_with_axiom import CategoryWithAxiom_over_base_ring +from sage.categories.tensor import TensorProductsCategory, tensor +from sage.categories.unital_algebras import UnitalAlgebras from sage.misc.cachefunc import cached_method from sage.misc.lazy_attribute import lazy_attribute from sage.misc.lazy_import import LazyImport -from sage.categories.tensor import TensorProductsCategory, tensor -from sage.categories.cartesian_product import CartesianProductsCategory -from sage.categories.category_with_axiom import CategoryWithAxiom_over_base_ring -from .unital_algebras import UnitalAlgebras class AlgebrasWithBasis(CategoryWithAxiom_over_base_ring): diff --git a/src/sage/categories/all.py b/src/sage/categories/all.py index 110a9954da3..936346c5d13 100644 --- a/src/sage/categories/all.py +++ b/src/sage/categories/all.py @@ -25,130 +25,49 @@ """ # install the docstring of this module to the containing package from sage.misc.namespace_package import install_doc -install_doc(__package__, __doc__) - -from . import primer - -from sage.misc.lazy_import import lazy_import - -from .all__sagemath_objects import * - -from .basic import * - -from .chain_complexes import ChainComplexes, HomologyFunctor - -from .simplicial_complexes import SimplicialComplexes - -from .tensor import tensor -from .signed_tensor import tensor_signed -from .g_sets import GSets -from .pointed_sets import PointedSets +install_doc(__package__, __doc__) -from .sets_with_grading import SetsWithGrading -from .groupoid import Groupoid -from .permutation_groups import PermutationGroups +from sage.categories.all__sagemath_objects import * +from sage.categories.basic import * # enumerated sets -from .finite_sets import FiniteSets -from .enumerated_sets import EnumeratedSets -from .finite_enumerated_sets import FiniteEnumeratedSets -from .infinite_enumerated_sets import InfiniteEnumeratedSets - # posets -from .posets import Posets -from .finite_posets import FinitePosets -from .lattice_posets import LatticePosets -from .finite_lattice_posets import FiniteLatticePosets - # finite groups/... -from .finite_semigroups import FiniteSemigroups -from .finite_monoids import FiniteMonoids -from .finite_groups import FiniteGroups -from .finite_permutation_groups import FinitePermutationGroups - # fields -from .number_fields import NumberFields -from .function_fields import FunctionFields - # modules -from .left_modules import LeftModules -from .right_modules import RightModules -from .bimodules import Bimodules +from sage.categories.modules import Modules +from sage.misc.lazy_import import lazy_import -from .modules import Modules RingModules = Modules -from .vector_spaces import VectorSpaces # (hopf) algebra structures -from .algebras import Algebras -from .commutative_algebras import CommutativeAlgebras -from .coalgebras import Coalgebras -from .bialgebras import Bialgebras -from .hopf_algebras import HopfAlgebras -from .lie_algebras import LieAlgebras # specific algebras -from .monoid_algebras import MonoidAlgebras -from .group_algebras import GroupAlgebras -from .matrix_algebras import MatrixAlgebras # ideals -from .ring_ideals import RingIdeals +from sage.categories.ring_ideals import RingIdeals + Ideals = RingIdeals -from .commutative_ring_ideals import CommutativeRingIdeals -from .algebra_modules import AlgebraModules -from .algebra_ideals import AlgebraIdeals -from .commutative_algebra_ideals import CommutativeAlgebraIdeals # schemes and varieties -from .modular_abelian_varieties import ModularAbelianVarieties -from .schemes import Schemes # * with basis -from .modules_with_basis import ModulesWithBasis +from sage.categories.modules_with_basis import ModulesWithBasis + FreeModules = ModulesWithBasis -from .hecke_modules import HeckeModules -from .algebras_with_basis import AlgebrasWithBasis -from .coalgebras_with_basis import CoalgebrasWithBasis -from .bialgebras_with_basis import BialgebrasWithBasis -from .hopf_algebras_with_basis import HopfAlgebrasWithBasis # finite dimensional * with basis -from .finite_dimensional_modules_with_basis import FiniteDimensionalModulesWithBasis -from .finite_dimensional_algebras_with_basis import FiniteDimensionalAlgebrasWithBasis -from .finite_dimensional_coalgebras_with_basis import FiniteDimensionalCoalgebrasWithBasis -from .finite_dimensional_bialgebras_with_basis import FiniteDimensionalBialgebrasWithBasis -from .finite_dimensional_hopf_algebras_with_basis import FiniteDimensionalHopfAlgebrasWithBasis # graded * -from .graded_modules import GradedModules -from .graded_algebras import GradedAlgebras -from .graded_coalgebras import GradedCoalgebras -from .graded_bialgebras import GradedBialgebras -from .graded_hopf_algebras import GradedHopfAlgebras # graded * with basis -from .graded_modules_with_basis import GradedModulesWithBasis -from .graded_algebras_with_basis import GradedAlgebrasWithBasis -from .graded_coalgebras_with_basis import GradedCoalgebrasWithBasis -from .graded_bialgebras_with_basis import GradedBialgebrasWithBasis -from .graded_hopf_algebras_with_basis import GradedHopfAlgebrasWithBasis # Coxeter groups -from .coxeter_groups import CoxeterGroups lazy_import('sage.categories.finite_coxeter_groups', 'FiniteCoxeterGroups') -from .weyl_groups import WeylGroups -from .finite_weyl_groups import FiniteWeylGroups -from .affine_weyl_groups import AffineWeylGroups # crystal bases -from .crystals import Crystals -from .highest_weight_crystals import HighestWeightCrystals -from .regular_crystals import RegularCrystals -from .finite_crystals import FiniteCrystals -from .classical_crystals import ClassicalCrystals # polyhedra lazy_import('sage.categories.polyhedra', 'PolyhedralSets') diff --git a/src/sage/categories/all__sagemath_objects.py b/src/sage/categories/all__sagemath_objects.py index dee0881d787..979ce64ce7b 100644 --- a/src/sage/categories/all__sagemath_objects.py +++ b/src/sage/categories/all__sagemath_objects.py @@ -1,31 +1,16 @@ # Subset of sage.categories.all that is made available by the sage-objects distribution -from sage.misc.lazy_import import lazy_import # Resolve a circular import so that "import sage.categories.all" can succeed # in initializing the category system. -import sage.structure.category_object # imports sage.categories.category # Small part of "from .basic import *": -from .objects import Objects -from .sets_cat import Sets, EmptySetError -from .category import Category -from .category_types import Elements -from .cartesian_product import cartesian_product -from .functor import (ForgetfulFunctor, - IdentityFunctor) -from .homset import (Hom, hom, - End, end, - Homset, HomsetWithBase) -from .morphism import Morphism -from .realizations import Realizations -from .sets_with_partial_maps import SetsWithPartialMaps diff --git a/src/sage/categories/basic.py b/src/sage/categories/basic.py index b3cf1d3a29c..f81d226fb36 100644 --- a/src/sage/categories/basic.py +++ b/src/sage/categories/basic.py @@ -9,42 +9,17 @@ # http://www.gnu.org/licenses/ #****************************************************************************** -from .objects import Objects -from .sets_cat import Sets, EmptySetError -from .posets import Posets +from sage.categories.posets import Posets + # For backward compatibility; will be deprecated at some point PartiallyOrderedSets = Posets OrderedSets = Posets -from .additive_magmas import AdditiveMagmas -from .commutative_additive_semigroups import CommutativeAdditiveSemigroups -from .commutative_additive_monoids import CommutativeAdditiveMonoids -from .commutative_additive_groups import CommutativeAdditiveGroups -from .magmas import Magmas -from .semigroups import Semigroups -from .monoids import Monoids -from .groups import Groups -from .partially_ordered_monoids import PartiallyOrderedMonoids +from sage.categories.partially_ordered_monoids import PartiallyOrderedMonoids + # For backward compatibility; might be deprecated at some point OrderedMonoids = PartiallyOrderedMonoids -from .rngs import Rngs -from .semirings import Semirings -from .rings import Rings -from .domains import Domains -from .division_rings import DivisionRings - -from .commutative_rings import CommutativeRings -from .integral_domains import IntegralDomains -from .gcd_domains import GcdDomains -from .principal_ideal_domains import PrincipalIdealDomains -from .euclidean_domains import EuclideanDomains -from .unique_factorization_domains import UniqueFactorizationDomains -from .complete_discrete_valuation import CompleteDiscreteValuationRings - -from .fields import Fields -from .quotient_fields import QuotientFields -from .finite_fields import FiniteFields -from .discrete_valuation import DiscreteValuationRings, DiscreteValuationFields -from .complete_discrete_valuation import CompleteDiscreteValuationRings, CompleteDiscreteValuationFields + + diff --git a/src/sage/categories/category_singleton.pyx b/src/sage/categories/category_singleton.pyx index 543ce0375f7..d07bcaa5586 100644 --- a/src/sage/categories/category_singleton.pyx +++ b/src/sage/categories/category_singleton.pyx @@ -15,6 +15,8 @@ from sage.categories.category import Category from sage.structure.category_object cimport CategoryObject from sage.structure.dynamic_class import DynamicMetaclass +# I have no idea why this is necessary, but otherwise the type import fails +from cpython.method cimport PyMethod_Check from cpython.type cimport PyType_IsSubtype # This helper class is used to implement Category_singleton.__contains__ diff --git a/src/sage/categories/category_types.py b/src/sage/categories/category_types.py index cb18dcd42c0..c9e2fe79130 100644 --- a/src/sage/categories/category_types.py +++ b/src/sage/categories/category_types.py @@ -14,9 +14,10 @@ # http://www.gnu.org/licenses/ #***************************************************************************** -from sage.misc.unknown import Unknown -from .category import JoinCategory, Category, CategoryWithParameters +from sage.categories.category import Category, CategoryWithParameters, JoinCategory from sage.misc.lazy_import import lazy_import +from sage.misc.unknown import Unknown + lazy_import('sage.categories.objects', 'Objects') lazy_import('sage.misc.latex', 'latex') @@ -196,6 +197,7 @@ def _test_category_over_bases(self, **options): """ tester = self._tester(**options) from sage.categories.category_singleton import Category_singleton + from .bimodules import Bimodules from .schemes import Schemes for cat in self.super_categories(): diff --git a/src/sage/categories/chain_complexes.py b/src/sage/categories/chain_complexes.py index db9c5d03f56..2d3823aba73 100644 --- a/src/sage/categories/chain_complexes.py +++ b/src/sage/categories/chain_complexes.py @@ -13,11 +13,12 @@ # http://www.gnu.org/licenses/ #***************************************************************************** -from .category_types import Category_module -from .commutative_additive_groups import CommutativeAdditiveGroups -from .functor import Functor +from sage.categories.category_types import Category_module +from sage.categories.commutative_additive_groups import CommutativeAdditiveGroups +from sage.categories.functor import Functor from sage.misc.abstract_method import abstract_method + ############################################################# # ChainComplex ############################################################# @@ -259,8 +260,8 @@ def _apply_functor_to_morphism(self, f): sage: id_star(one) [one] """ - from .morphism import SetMorphism from .homset import Hom + from .morphism import SetMorphism domain = f.domain() codomain = f.codomain() diff --git a/src/sage/categories/coalgebras.py b/src/sage/categories/coalgebras.py index abe36aef0bb..b69fdf29784 100644 --- a/src/sage/categories/coalgebras.py +++ b/src/sage/categories/coalgebras.py @@ -10,14 +10,14 @@ # https://www.gnu.org/licenses/ # ***************************************************************************** -from .category_types import Category_over_base_ring -from sage.categories.modules import Modules +from sage.categories.category_types import Category_over_base_ring from sage.categories.category_with_axiom import CategoryWithAxiom_over_base_ring -from sage.categories.tensor import TensorProductsCategory from sage.categories.dual import DualObjectsCategory from sage.categories.filtered_modules import FilteredModulesCategory -from sage.categories.super_modules import SuperModulesCategory +from sage.categories.modules import Modules from sage.categories.realizations import RealizationsCategory +from sage.categories.super_modules import SuperModulesCategory +from sage.categories.tensor import TensorProductsCategory from sage.categories.with_realizations import WithRealizationsCategory from sage.misc.abstract_method import abstract_method from sage.misc.cachefunc import cached_method diff --git a/src/sage/categories/commutative_algebra_ideals.py b/src/sage/categories/commutative_algebra_ideals.py index 070503ae6c8..e47e1c4f87e 100644 --- a/src/sage/categories/commutative_algebra_ideals.py +++ b/src/sage/categories/commutative_algebra_ideals.py @@ -10,10 +10,10 @@ # http://www.gnu.org/licenses/ #****************************************************************************** -from .algebra_ideals import AlgebraIdeals -from .category_types import Category_ideal, Category_in_ambient -from .commutative_algebras import CommutativeAlgebras -from .commutative_rings import CommutativeRings +from sage.categories.algebra_ideals import AlgebraIdeals +from sage.categories.category_types import Category_ideal, Category_in_ambient +from sage.categories.commutative_algebras import CommutativeAlgebras +from sage.categories.commutative_rings import CommutativeRings class CommutativeAlgebraIdeals(Category_ideal): diff --git a/src/sage/categories/commutative_ring_ideals.py b/src/sage/categories/commutative_ring_ideals.py index 5aef6d7d31d..8659b0c793b 100644 --- a/src/sage/categories/commutative_ring_ideals.py +++ b/src/sage/categories/commutative_ring_ideals.py @@ -10,9 +10,10 @@ # http://www.gnu.org/licenses/ #****************************************************************************** -from .category_types import Category_ideal +from sage.categories.category_types import Category_ideal from sage.categories.commutative_rings import CommutativeRings -from .ring_ideals import RingIdeals +from sage.categories.ring_ideals import RingIdeals + class CommutativeRingIdeals(Category_ideal): """ diff --git a/src/sage/categories/complete_discrete_valuation.py b/src/sage/categories/complete_discrete_valuation.py index 442360465a1..7376d947530 100644 --- a/src/sage/categories/complete_discrete_valuation.py +++ b/src/sage/categories/complete_discrete_valuation.py @@ -9,10 +9,13 @@ #************************************************************************** +from sage.categories.category_singleton import Category_singleton +from sage.categories.discrete_valuation import ( + DiscreteValuationFields, + DiscreteValuationRings, +) from sage.misc.abstract_method import abstract_method -from sage.categories.category_singleton import Category_singleton -from .discrete_valuation import DiscreteValuationRings, DiscreteValuationFields #from sage.misc.cachefunc import cached_method diff --git a/src/sage/categories/finite_dimensional_semisimple_algebras_with_basis.py b/src/sage/categories/finite_dimensional_semisimple_algebras_with_basis.py index 531ee7145a4..da4b297ddde 100644 --- a/src/sage/categories/finite_dimensional_semisimple_algebras_with_basis.py +++ b/src/sage/categories/finite_dimensional_semisimple_algebras_with_basis.py @@ -9,10 +9,11 @@ # http://www.gnu.org/licenses/ #****************************************************************************** +from sage.categories.algebras import Algebras from sage.categories.category_with_axiom import CategoryWithAxiom_over_base_ring +from sage.categories.semisimple_algebras import SemisimpleAlgebras from sage.misc.cachefunc import cached_method -from .algebras import Algebras -from .semisimple_algebras import SemisimpleAlgebras + class FiniteDimensionalSemisimpleAlgebrasWithBasis(CategoryWithAxiom_over_base_ring): """ diff --git a/src/sage/categories/functor.pyx b/src/sage/categories/functor.pyx index c25e99f2164..32bd079fc73 100644 --- a/src/sage/categories/functor.pyx +++ b/src/sage/categories/functor.pyx @@ -33,7 +33,7 @@ AUTHORS: # https://www.gnu.org/licenses/ # **************************************************************************** -from . import category +from sage.categories import category def _Functor_unpickle(Cl, D, domain, codomain): diff --git a/src/sage/categories/g_sets.py b/src/sage/categories/g_sets.py index 7fd09bafea4..5967fcf7d5f 100644 --- a/src/sage/categories/g_sets.py +++ b/src/sage/categories/g_sets.py @@ -11,7 +11,8 @@ #****************************************************************************** from sage.categories.category import Category -from .sets_cat import Sets +from sage.categories.sets_cat import Sets + ############################################################# # GSets diff --git a/src/sage/categories/groupoid.py b/src/sage/categories/groupoid.py index 850e63a2c09..95af5df164c 100644 --- a/src/sage/categories/groupoid.py +++ b/src/sage/categories/groupoid.py @@ -12,7 +12,8 @@ #****************************************************************************** from sage.categories.category import CategoryWithParameters -from .sets_cat import Sets +from sage.categories.sets_cat import Sets + class Groupoid(CategoryWithParameters): """ diff --git a/src/sage/categories/homset.py b/src/sage/categories/homset.py index 2a8b8aeedeb..d2203299512 100644 --- a/src/sage/categories/homset.py +++ b/src/sage/categories/homset.py @@ -65,12 +65,9 @@ # https://www.gnu.org/licenses/ # **************************************************************************** +from sage.categories import morphism from sage.categories.category import Category, JoinCategory -from . import morphism -from sage.structure.parent import Parent, Set_generic from sage.misc.fast_methods import WithEqualityById -from sage.structure.dynamic_class import dynamic_class -from sage.structure.unique_representation import UniqueRepresentation from sage.misc.lazy_attribute import lazy_attribute ################################### @@ -78,8 +75,11 @@ # introduced in github issue #715 # with weak values, as introduced in # github issue #14159 - from sage.structure.coerce_dict import TripleDict +from sage.structure.dynamic_class import dynamic_class +from sage.structure.parent import Parent, Set_generic +from sage.structure.unique_representation import UniqueRepresentation + _cache = TripleDict(weak_values=True) diff --git a/src/sage/categories/hopf_algebras.py b/src/sage/categories/hopf_algebras.py index 41e349690fe..218abc1ca27 100644 --- a/src/sage/categories/hopf_algebras.py +++ b/src/sage/categories/hopf_algebras.py @@ -8,14 +8,14 @@ # Distributed under the terms of the GNU General Public License (GPL) # https://www.gnu.org/licenses/ # ***************************************************************************** -from sage.misc.lazy_import import LazyImport -from .category import Category -from .category_types import Category_over_base_ring from sage.categories.bialgebras import Bialgebras -from sage.categories.tensor import TensorProductsCategory # tensor +from sage.categories.category import Category +from sage.categories.category_types import Category_over_base_ring from sage.categories.realizations import RealizationsCategory from sage.categories.super_modules import SuperModulesCategory +from sage.categories.tensor import TensorProductsCategory # tensor from sage.misc.cachefunc import cached_method +from sage.misc.lazy_import import LazyImport class HopfAlgebras(Category_over_base_ring): diff --git a/src/sage/categories/l_trivial_semigroups.py b/src/sage/categories/l_trivial_semigroups.py index 53f03701e6f..9c483dcd3d1 100644 --- a/src/sage/categories/l_trivial_semigroups.py +++ b/src/sage/categories/l_trivial_semigroups.py @@ -13,8 +13,9 @@ #***************************************************************************** from sage.categories.category_with_axiom import CategoryWithAxiom -from .magmas import Magmas -from .semigroups import Semigroups +from sage.categories.magmas import Magmas +from sage.categories.semigroups import Semigroups + class LTrivialSemigroups(CategoryWithAxiom): def extra_super_categories(self): diff --git a/src/sage/categories/lambda_bracket_algebras.py b/src/sage/categories/lambda_bracket_algebras.py index 40cb5ed70c4..16dbd7c7fa9 100644 --- a/src/sage/categories/lambda_bracket_algebras.py +++ b/src/sage/categories/lambda_bracket_algebras.py @@ -16,13 +16,14 @@ # http://www.gnu.org/licenses/ #***************************************************************************** -from .category_types import Category_over_base_ring -from sage.misc.abstract_method import abstract_method +from sage.categories.category_types import Category_over_base_ring +from sage.categories.commutative_rings import CommutativeRings from sage.categories.modules import Modules -from sage.structure.element import coerce_binop +from sage.misc.abstract_method import abstract_method from sage.misc.cachefunc import cached_method -from sage.categories.commutative_rings import CommutativeRings from sage.misc.lazy_import import LazyImport +from sage.structure.element import coerce_binop + _CommutativeRings = CommutativeRings() @@ -53,7 +54,7 @@ def __classcall_private__(cls, R, check=True): Category of Lie conformal algebras over Integer Ring """ if check: - if not (R in _CommutativeRings): + if R not in _CommutativeRings: raise ValueError("base must be a commutative ring got {}".format(R)) return super().__classcall__(cls, R) diff --git a/src/sage/categories/left_modules.py b/src/sage/categories/left_modules.py index c92a13f7979..51de3497a53 100644 --- a/src/sage/categories/left_modules.py +++ b/src/sage/categories/left_modules.py @@ -8,9 +8,10 @@ # http://www.gnu.org/licenses/ #****************************************************************************** -from .category_types import Category_over_base_ring +from sage.categories.category_types import Category_over_base_ring from sage.categories.commutative_additive_groups import CommutativeAdditiveGroups + #?class LeftModules(Category_over_base_rng): class LeftModules(Category_over_base_ring): """ diff --git a/src/sage/categories/lie_conformal_algebras.py b/src/sage/categories/lie_conformal_algebras.py index ee48889dd0b..8ade3811845 100644 --- a/src/sage/categories/lie_conformal_algebras.py +++ b/src/sage/categories/lie_conformal_algebras.py @@ -125,11 +125,12 @@ # http://www.gnu.org/licenses/ #***************************************************************************** -from .category_types import Category_over_base_ring -from sage.misc.cachefunc import cached_method +from sage.categories.category_types import Category_over_base_ring from sage.categories.lambda_bracket_algebras import LambdaBracketAlgebras +from sage.misc.cachefunc import cached_method from sage.misc.lazy_import import LazyImport + class LieConformalAlgebras(Category_over_base_ring): r""" The category of Lie conformal algebras. @@ -224,8 +225,9 @@ def example(self): sage: LieConformalAlgebras(QQ).example() # needs sage.combinat sage.modules The Virasoro Lie conformal algebra over Rational Field """ - from sage.algebras.lie_conformal_algebras.virasoro_lie_conformal_algebra\ - import VirasoroLieConformalAlgebra + from sage.algebras.lie_conformal_algebras.virasoro_lie_conformal_algebra import ( + VirasoroLieConformalAlgebra, + ) return VirasoroLieConformalAlgebra(self.base_ring()) def _repr_object_names(self): @@ -284,8 +286,8 @@ def _test_jacobi(self, **options): """ tester = self._tester(**options) S = tester.some_elements() - from sage.misc.misc import some_tuples from sage.arith.misc import binomial + from sage.misc.misc import some_tuples pz = tester._instance.zero() for x,y,z in some_tuples(S, 3, tester._max_runs): brxy = x.bracket(y) diff --git a/src/sage/categories/map.pyx b/src/sage/categories/map.pyx index 45c30ae6c31..71c3ef3f1d2 100644 --- a/src/sage/categories/map.pyx +++ b/src/sage/categories/map.pyx @@ -21,7 +21,7 @@ AUTHORS: # https://www.gnu.org/licenses/ # **************************************************************************** -from . import homset +from sage.categories import homset import weakref from sage.ext.stdsage cimport HAS_DICTIONARY from sage.arith.power cimport generic_power diff --git a/src/sage/categories/matrix_algebras.py b/src/sage/categories/matrix_algebras.py index 90eef738be6..08b102d7451 100644 --- a/src/sage/categories/matrix_algebras.py +++ b/src/sage/categories/matrix_algebras.py @@ -10,8 +10,9 @@ # http://www.gnu.org/licenses/ #****************************************************************************** -from .category_types import Category_over_base_ring -from .algebras import Algebras +from sage.categories.algebras import Algebras +from sage.categories.category_types import Category_over_base_ring + class MatrixAlgebras(Category_over_base_ring): """ diff --git a/src/sage/categories/modular_abelian_varieties.py b/src/sage/categories/modular_abelian_varieties.py index a1337e700cd..804361a7f99 100644 --- a/src/sage/categories/modular_abelian_varieties.py +++ b/src/sage/categories/modular_abelian_varieties.py @@ -10,11 +10,12 @@ # http://www.gnu.org/licenses/ #****************************************************************************** -from .category_types import Category_over_base -from .category_with_axiom import CategoryWithAxiom -from .homsets import HomsetsCategory -from .rings import Rings -from .sets_cat import Sets +from sage.categories.category_types import Category_over_base +from sage.categories.category_with_axiom import CategoryWithAxiom +from sage.categories.homsets import HomsetsCategory +from sage.categories.rings import Rings +from sage.categories.sets_cat import Sets + class ModularAbelianVarieties(Category_over_base): """ diff --git a/src/sage/categories/modules.py b/src/sage/categories/modules.py index e65bab4faf8..c4f5127306f 100644 --- a/src/sage/categories/modules.py +++ b/src/sage/categories/modules.py @@ -11,21 +11,22 @@ # https://www.gnu.org/licenses/ # ***************************************************************************** -from sage.misc.cachefunc import cached_method -from sage.misc.abstract_method import abstract_method -from sage.misc.lazy_import import LazyImport +from sage.categories.bimodules import Bimodules +from sage.categories.cartesian_product import CartesianProductsCategory +from sage.categories.category import Category +from sage.categories.category_types import Category_module from sage.categories.category_with_axiom import CategoryWithAxiom_over_base_ring -from sage.categories.morphism import SetMorphism -from sage.categories.homsets import HomsetsCategory +from sage.categories.dual import DualObjectsCategory +from sage.categories.fields import Fields from sage.categories.homset import Hom -from .category import Category -from .category_types import Category_module -from sage.categories.tensor import TensorProductsCategory, TensorProductFunctor, tensor -from .dual import DualObjectsCategory -from sage.categories.cartesian_product import CartesianProductsCategory +from sage.categories.homsets import HomsetsCategory +from sage.categories.morphism import SetMorphism from sage.categories.sets_cat import Sets -from sage.categories.bimodules import Bimodules -from sage.categories.fields import Fields +from sage.categories.tensor import TensorProductFunctor, TensorProductsCategory, tensor +from sage.misc.abstract_method import abstract_method +from sage.misc.cachefunc import cached_method +from sage.misc.lazy_import import LazyImport + _Fields = Fields() diff --git a/src/sage/categories/morphism.pxd b/src/sage/categories/morphism.pxd index fce5487d829..2222a9c679a 100644 --- a/src/sage/categories/morphism.pxd +++ b/src/sage/categories/morphism.pxd @@ -1,5 +1,5 @@ from sage.structure.element cimport Element -from .map cimport Map +from sage.categories.map cimport Map cdef class Morphism(Map): diff --git a/src/sage/categories/pointed_sets.py b/src/sage/categories/pointed_sets.py index fd91b3b07f3..27376140dbe 100644 --- a/src/sage/categories/pointed_sets.py +++ b/src/sage/categories/pointed_sets.py @@ -11,7 +11,8 @@ #****************************************************************************** from sage.categories.category_singleton import Category_singleton -from .sets_cat import Sets +from sage.categories.sets_cat import Sets + class PointedSets(Category_singleton): """ diff --git a/src/sage/categories/pushout.py b/src/sage/categories/pushout.py index 3b7b8238d52..a23557037b0 100644 --- a/src/sage/categories/pushout.py +++ b/src/sage/categories/pushout.py @@ -27,9 +27,9 @@ import operator +from sage.categories.functor import Functor, IdentityFunctor_generic from sage.misc.lazy_import import lazy_import from sage.structure.coerce_exceptions import CoercionException -from .functor import Functor, IdentityFunctor_generic lazy_import('sage.categories.commutative_additive_groups', 'CommutativeAdditiveGroups') lazy_import('sage.categories.commutative_rings', 'CommutativeRings') @@ -902,7 +902,9 @@ def _apply_functor_to_morphism(self, f): From: Integer Ring To: Finite Field of size 3 """ - from sage.rings.polynomial.polynomial_ring_homomorphism import PolynomialRingHomomorphism_from_base + from sage.rings.polynomial.polynomial_ring_homomorphism import ( + PolynomialRingHomomorphism_from_base, + ) R = self._apply_functor(f.domain()) S = self._apply_functor(f.codomain()) return PolynomialRingHomomorphism_from_base(R.Hom(S), f) @@ -1329,7 +1331,9 @@ def _apply_functor(self, R): Infinite polynomial ring in a, b, x over Univariate Polynomial Ring in t over Rational Field """ - from sage.rings.polynomial.infinite_polynomial_ring import InfinitePolynomialRing + from sage.rings.polynomial.infinite_polynomial_ring import ( + InfinitePolynomialRing, + ) return InfinitePolynomialRing(R, self._gens, order=self._order, implementation=self._imple) def _repr_(self): @@ -1795,7 +1799,9 @@ def _apply_functor(self, R): """ from sage.rings.polynomial.laurent_polynomial_ring import LaurentPolynomialRing - from sage.rings.polynomial.laurent_polynomial_ring_base import LaurentPolynomialRing_generic + from sage.rings.polynomial.laurent_polynomial_ring_base import ( + LaurentPolynomialRing_generic, + ) if self.multi_variate and isinstance(R, LaurentPolynomialRing_generic): return LaurentPolynomialRing(R.base_ring(), list(R.variable_names()) + [self.var]) else: @@ -2474,8 +2480,8 @@ def __init__(self): sage: F(ZZ['t']) Fraction Field of Univariate Polynomial Ring in t over Integer Ring """ - from sage.categories.integral_domains import IntegralDomains from sage.categories.fields import Fields + from sage.categories.integral_domains import IntegralDomains Functor.__init__(self, IntegralDomains(), Fields()) def _apply_functor(self, R): @@ -3383,8 +3389,8 @@ def _apply_functor(self, R): 3-adic Eisenstein Extension Field in a defined by a^2 - 3 """ - from sage.rings.rational_field import QQ from sage.rings.integer_ring import ZZ + from sage.rings.rational_field import QQ if self.cyclotomic: from sage.rings.number_field.number_field import CyclotomicField if R == QQ: diff --git a/src/sage/categories/r_trivial_semigroups.py b/src/sage/categories/r_trivial_semigroups.py index 93ba9e61ca8..7b5c9fea5ed 100644 --- a/src/sage/categories/r_trivial_semigroups.py +++ b/src/sage/categories/r_trivial_semigroups.py @@ -13,7 +13,8 @@ #***************************************************************************** from sage.categories.category_with_axiom import CategoryWithAxiom -from .semigroups import Semigroups +from sage.categories.semigroups import Semigroups + class RTrivialSemigroups(CategoryWithAxiom): def extra_super_categories(self): diff --git a/src/sage/categories/right_modules.py b/src/sage/categories/right_modules.py index 5a7557c4663..47a8081d2a9 100644 --- a/src/sage/categories/right_modules.py +++ b/src/sage/categories/right_modules.py @@ -8,9 +8,10 @@ # http://www.gnu.org/licenses/ #****************************************************************************** -from .category_types import Category_over_base_ring +from sage.categories.category_types import Category_over_base_ring from sage.categories.commutative_additive_groups import CommutativeAdditiveGroups + ##?class RightModules(Category_over_base_rng): class RightModules(Category_over_base_ring): """ diff --git a/src/sage/categories/ring_ideals.py b/src/sage/categories/ring_ideals.py index 51573635ef0..fd634f1caef 100644 --- a/src/sage/categories/ring_ideals.py +++ b/src/sage/categories/ring_ideals.py @@ -10,9 +10,10 @@ # https://www.gnu.org/licenses/ # ***************************************************************************** -from .category_types import Category_ideal -from .modules import Modules +from sage.categories.category_types import Category_ideal +from sage.categories.modules import Modules from sage.categories.rings import Rings + _Rings = Rings() diff --git a/src/sage/categories/semirings.py b/src/sage/categories/semirings.py index cbff0b29a8e..62e6f7d918f 100644 --- a/src/sage/categories/semirings.py +++ b/src/sage/categories/semirings.py @@ -9,7 +9,8 @@ #****************************************************************************** from sage.categories.category_with_axiom import CategoryWithAxiom -from .magmas_and_additive_magmas import MagmasAndAdditiveMagmas +from sage.categories.magmas_and_additive_magmas import MagmasAndAdditiveMagmas + class Semirings(CategoryWithAxiom): """ diff --git a/src/sage/categories/semisimple_algebras.py b/src/sage/categories/semisimple_algebras.py index 9a310614290..453b854b7e7 100644 --- a/src/sage/categories/semisimple_algebras.py +++ b/src/sage/categories/semisimple_algebras.py @@ -8,12 +8,13 @@ # http://www.gnu.org/licenses/ #****************************************************************************** +from sage.categories.algebras import Algebras +from sage.categories.category_types import Category_over_base_ring +from sage.categories.category_with_axiom import CategoryWithAxiom_over_base_ring from sage.misc.bindable_class import BoundClass from sage.misc.cachefunc import cached_method from sage.misc.lazy_import import LazyImport -from .category_types import Category_over_base_ring -from sage.categories.category_with_axiom import CategoryWithAxiom_over_base_ring -from .algebras import Algebras + class SemisimpleAlgebras(Category_over_base_ring): """ diff --git a/src/sage/categories/sets_with_grading.py b/src/sage/categories/sets_with_grading.py index b1e321f67f2..a29d8c9c59c 100644 --- a/src/sage/categories/sets_with_grading.py +++ b/src/sage/categories/sets_with_grading.py @@ -8,11 +8,11 @@ # https://www.gnu.org/licenses/ # ***************************************************************************** -from sage.misc.cachefunc import cached_method -from sage.misc.abstract_method import abstract_method -from .category_types import Category -from sage.categories.sets_cat import Sets +from sage.categories.category_types import Category from sage.categories.enumerated_sets import EnumeratedSets +from sage.categories.sets_cat import Sets +from sage.misc.abstract_method import abstract_method +from sage.misc.cachefunc import cached_method class SetsWithGrading(Category): @@ -220,9 +220,9 @@ def generating_series(self): - Very likely, this should always return a lazy power series. """ - from sage.sets.non_negative_integers import NonNegativeIntegers - from sage.rings.lazy_series_ring import LazyPowerSeriesRing from sage.rings.integer_ring import ZZ + from sage.rings.lazy_series_ring import LazyPowerSeriesRing + from sage.sets.non_negative_integers import NonNegativeIntegers if isinstance(self.grading_set(), NonNegativeIntegers): R = LazyPowerSeriesRing(ZZ, names="z") return R(lambda n: self.graded_component(n).cardinality()) diff --git a/src/sage/categories/sets_with_partial_maps.py b/src/sage/categories/sets_with_partial_maps.py index 5b2f9b35427..4210548b0fd 100644 --- a/src/sage/categories/sets_with_partial_maps.py +++ b/src/sage/categories/sets_with_partial_maps.py @@ -11,7 +11,7 @@ #****************************************************************************** from sage.categories.category_singleton import Category_singleton -from .objects import Objects +from sage.categories.objects import Objects class SetsWithPartialMaps(Category_singleton): From bac9d7c7aba31d18c813d4bbf9c0af6d76dc1464 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Mon, 30 Oct 2023 11:31:23 +0000 Subject: [PATCH 2/2] cleanup --- src/sage/categories/all.py | 91 ++++++++++++++++++-- src/sage/categories/all__sagemath_objects.py | 14 ++- src/sage/categories/basic.py | 45 ++++++++-- src/sage/categories/category_singleton.pyx | 2 - src/sage/categories/chain_complexes.py | 4 +- 5 files changed, 141 insertions(+), 15 deletions(-) diff --git a/src/sage/categories/all.py b/src/sage/categories/all.py index 936346c5d13..9c2b8bd6518 100644 --- a/src/sage/categories/all.py +++ b/src/sage/categories/all.py @@ -25,49 +25,130 @@ """ # install the docstring of this module to the containing package from sage.misc.namespace_package import install_doc - install_doc(__package__, __doc__) +from sage.categories import primer + +from sage.misc.lazy_import import lazy_import from sage.categories.all__sagemath_objects import * + from sage.categories.basic import * +from sage.categories.chain_complexes import ChainComplexes, HomologyFunctor + +from sage.categories.simplicial_complexes import SimplicialComplexes + +from sage.categories.tensor import tensor +from sage.categories.signed_tensor import tensor_signed + +from sage.categories.g_sets import GSets +from sage.categories.pointed_sets import PointedSets + +from sage.categories.sets_with_grading import SetsWithGrading + +from sage.categories.groupoid import Groupoid +from sage.categories.permutation_groups import PermutationGroups + # enumerated sets +from sage.categories.finite_sets import FiniteSets +from sage.categories.enumerated_sets import EnumeratedSets +from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets +from sage.categories.infinite_enumerated_sets import InfiniteEnumeratedSets + # posets +from sage.categories.posets import Posets +from sage.categories.finite_posets import FinitePosets +from sage.categories.lattice_posets import LatticePosets +from sage.categories.finite_lattice_posets import FiniteLatticePosets + # finite groups/... +from sage.categories.finite_semigroups import FiniteSemigroups +from sage.categories.finite_monoids import FiniteMonoids +from sage.categories.finite_groups import FiniteGroups +from sage.categories.finite_permutation_groups import FinitePermutationGroups + # fields +from sage.categories.number_fields import NumberFields +from sage.categories.function_fields import FunctionFields + # modules -from sage.categories.modules import Modules -from sage.misc.lazy_import import lazy_import +from sage.categories.left_modules import LeftModules +from sage.categories.right_modules import RightModules +from sage.categories.bimodules import Bimodules +from sage.categories.modules import Modules RingModules = Modules +from sage.categories.vector_spaces import VectorSpaces # (hopf) algebra structures +from sage.categories.algebras import Algebras +from sage.categories.commutative_algebras import CommutativeAlgebras +from sage.categories.coalgebras import Coalgebras +from sage.categories.bialgebras import Bialgebras +from sage.categories.hopf_algebras import HopfAlgebras +from sage.categories.lie_algebras import LieAlgebras # specific algebras +from sage.categories.monoid_algebras import MonoidAlgebras +from sage.categories.group_algebras import GroupAlgebras +from sage.categories.matrix_algebras import MatrixAlgebras # ideals from sage.categories.ring_ideals import RingIdeals - Ideals = RingIdeals +from sage.categories.commutative_ring_ideals import CommutativeRingIdeals +from sage.categories.algebra_modules import AlgebraModules +from sage.categories.algebra_ideals import AlgebraIdeals +from sage.categories.commutative_algebra_ideals import CommutativeAlgebraIdeals # schemes and varieties +from sage.categories.modular_abelian_varieties import ModularAbelianVarieties +from sage.categories.schemes import Schemes # * with basis from sage.categories.modules_with_basis import ModulesWithBasis - FreeModules = ModulesWithBasis +from sage.categories.hecke_modules import HeckeModules +from sage.categories.algebras_with_basis import AlgebrasWithBasis +from sage.categories.coalgebras_with_basis import CoalgebrasWithBasis +from sage.categories.bialgebras_with_basis import BialgebrasWithBasis +from sage.categories.hopf_algebras_with_basis import HopfAlgebrasWithBasis # finite dimensional * with basis +from sage.categories.finite_dimensional_modules_with_basis import FiniteDimensionalModulesWithBasis +from sage.categories.finite_dimensional_algebras_with_basis import FiniteDimensionalAlgebrasWithBasis +from sage.categories.finite_dimensional_coalgebras_with_basis import FiniteDimensionalCoalgebrasWithBasis +from sage.categories.finite_dimensional_bialgebras_with_basis import FiniteDimensionalBialgebrasWithBasis +from sage.categories.finite_dimensional_hopf_algebras_with_basis import FiniteDimensionalHopfAlgebrasWithBasis # graded * +from sage.categories.graded_modules import GradedModules +from sage.categories.graded_algebras import GradedAlgebras +from sage.categories.graded_coalgebras import GradedCoalgebras +from sage.categories.graded_bialgebras import GradedBialgebras +from sage.categories.graded_hopf_algebras import GradedHopfAlgebras # graded * with basis +from sage.categories.graded_modules_with_basis import GradedModulesWithBasis +from sage.categories.graded_algebras_with_basis import GradedAlgebrasWithBasis +from sage.categories.graded_coalgebras_with_basis import GradedCoalgebrasWithBasis +from sage.categories.graded_bialgebras_with_basis import GradedBialgebrasWithBasis +from sage.categories.graded_hopf_algebras_with_basis import GradedHopfAlgebrasWithBasis # Coxeter groups +from sage.categories.coxeter_groups import CoxeterGroups lazy_import('sage.categories.finite_coxeter_groups', 'FiniteCoxeterGroups') +from sage.categories.weyl_groups import WeylGroups +from sage.categories.finite_weyl_groups import FiniteWeylGroups +from sage.categories.affine_weyl_groups import AffineWeylGroups # crystal bases +from sage.categories.crystals import Crystals +from sage.categories.highest_weight_crystals import HighestWeightCrystals +from sage.categories.regular_crystals import RegularCrystals +from sage.categories.finite_crystals import FiniteCrystals +from sage.categories.classical_crystals import ClassicalCrystals # polyhedra lazy_import('sage.categories.polyhedra', 'PolyhedralSets') diff --git a/src/sage/categories/all__sagemath_objects.py b/src/sage/categories/all__sagemath_objects.py index 979ce64ce7b..d87b4a1d20e 100644 --- a/src/sage/categories/all__sagemath_objects.py +++ b/src/sage/categories/all__sagemath_objects.py @@ -1,16 +1,28 @@ # Subset of sage.categories.all that is made available by the sage-objects distribution +from sage.misc.lazy_import import lazy_import # Resolve a circular import so that "import sage.categories.all" can succeed # in initializing the category system. +import sage.structure.category_object # imports sage.categories.category -# Small part of "from .basic import *": +# Small part of "from sage.categories.basic import *": +from sage.categories.objects import Objects +from sage.categories.sets_cat import Sets, EmptySetError +from sage.categories.category import Category +from sage.categories.category_types import Elements +from sage.categories.cartesian_product import cartesian_product +from sage.categories.functor import ForgetfulFunctor, IdentityFunctor +from sage.categories.homset import Hom, hom, End, end, Homset, HomsetWithBase +from sage.categories.morphism import Morphism +from sage.categories.realizations import Realizations +from sage.categories.sets_with_partial_maps import SetsWithPartialMaps diff --git a/src/sage/categories/basic.py b/src/sage/categories/basic.py index f81d226fb36..f3574db469d 100644 --- a/src/sage/categories/basic.py +++ b/src/sage/categories/basic.py @@ -2,24 +2,59 @@ A subset of sage.categories.all with just the basic categories needed for sage startup (i.e. to define ZZ, QQ, ...). """ -#***************************************************************************** +# ***************************************************************************** # Copyright (C) 2008-2009 Nicolas M. Thiery # # Distributed under the terms of the GNU General Public License (GPL) # http://www.gnu.org/licenses/ -#****************************************************************************** +# ****************************************************************************** +from sage.categories.objects import Objects +from sage.categories.sets_cat import Sets, EmptySetError from sage.categories.posets import Posets # For backward compatibility; will be deprecated at some point PartiallyOrderedSets = Posets OrderedSets = Posets - +from sage.categories.additive_magmas import AdditiveMagmas +from sage.categories.commutative_additive_semigroups import ( + CommutativeAdditiveSemigroups, +) +from sage.categories.commutative_additive_monoids import CommutativeAdditiveMonoids +from sage.categories.commutative_additive_groups import CommutativeAdditiveGroups + +from sage.categories.magmas import Magmas +from sage.categories.semigroups import Semigroups +from sage.categories.monoids import Monoids +from sage.categories.groups import Groups from sage.categories.partially_ordered_monoids import PartiallyOrderedMonoids # For backward compatibility; might be deprecated at some point OrderedMonoids = PartiallyOrderedMonoids - - +from sage.categories.rngs import Rngs +from sage.categories.semirings import Semirings +from sage.categories.rings import Rings +from sage.categories.domains import Domains +from sage.categories.division_rings import DivisionRings + +from sage.categories.commutative_rings import CommutativeRings +from sage.categories.integral_domains import IntegralDomains +from sage.categories.gcd_domains import GcdDomains +from sage.categories.principal_ideal_domains import PrincipalIdealDomains +from sage.categories.euclidean_domains import EuclideanDomains +from sage.categories.unique_factorization_domains import UniqueFactorizationDomains +from sage.categories.complete_discrete_valuation import CompleteDiscreteValuationRings + +from sage.categories.fields import Fields +from sage.categories.quotient_fields import QuotientFields +from sage.categories.finite_fields import FiniteFields +from sage.categories.discrete_valuation import ( + DiscreteValuationRings, + DiscreteValuationFields, +) +from sage.categories.complete_discrete_valuation import ( + CompleteDiscreteValuationRings, + CompleteDiscreteValuationFields, +) diff --git a/src/sage/categories/category_singleton.pyx b/src/sage/categories/category_singleton.pyx index d07bcaa5586..543ce0375f7 100644 --- a/src/sage/categories/category_singleton.pyx +++ b/src/sage/categories/category_singleton.pyx @@ -15,8 +15,6 @@ from sage.categories.category import Category from sage.structure.category_object cimport CategoryObject from sage.structure.dynamic_class import DynamicMetaclass -# I have no idea why this is necessary, but otherwise the type import fails -from cpython.method cimport PyMethod_Check from cpython.type cimport PyType_IsSubtype # This helper class is used to implement Category_singleton.__contains__ diff --git a/src/sage/categories/chain_complexes.py b/src/sage/categories/chain_complexes.py index 2d3823aba73..9616aa608c4 100644 --- a/src/sage/categories/chain_complexes.py +++ b/src/sage/categories/chain_complexes.py @@ -260,8 +260,8 @@ def _apply_functor_to_morphism(self, f): sage: id_star(one) [one] """ - from .homset import Hom - from .morphism import SetMorphism + from sage.categories.homset import Hom + from sage.categories.morphism import SetMorphism domain = f.domain() codomain = f.codomain()