From 4cff0fef2e859812dc3d375a531f6365a1a8d2cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sat, 24 Feb 2024 20:52:42 +0100 Subject: [PATCH] fix suggested details --- src/sage/categories/action.pyx | 4 ++-- .../additive_abelian/additive_abelian_group.py | 12 +++++++----- src/sage/groups/group.pyx | 9 ++++++--- src/sage/groups/old.pyx | 4 ++-- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/sage/categories/action.pyx b/src/sage/categories/action.pyx index 0e54ceffa27..730cfff4786 100644 --- a/src/sage/categories/action.pyx +++ b/src/sage/categories/action.pyx @@ -381,10 +381,10 @@ cdef class InverseAction(Action): def __init__(self, Action action): G = action.G try: - from sage.groups.group import is_Group + from sage.groups.group import Group # We must be in the case that parent(~a) == parent(a) # so we can invert in _call_ code below. - if (is_Group(G) and G.is_multiplicative()) or G.is_field(): + if (isinstance(G, Group) and G.is_multiplicative()) or G.is_field(): Action.__init__(self, G, action.underlying_set(), action._is_left) self._action = action return diff --git a/src/sage/groups/additive_abelian/additive_abelian_group.py b/src/sage/groups/additive_abelian/additive_abelian_group.py index f913115f576..71af80acdf9 100644 --- a/src/sage/groups/additive_abelian/additive_abelian_group.py +++ b/src/sage/groups/additive_abelian/additive_abelian_group.py @@ -6,11 +6,10 @@ major differences are in the way elements are printed. """ -from sage.structure.parent import Parent -from sage.modules.fg_pid.fgp_module import FGP_Module_class +from sage.categories.commutative_additive_groups import CommutativeAdditiveGroups from sage.modules.fg_pid.fgp_element import FGP_Element +from sage.modules.fg_pid.fgp_module import FGP_Module_class from sage.rings.integer_ring import ZZ -from sage.categories.commutative_additive_groups import CommutativeAdditiveGroups def AdditiveAbelianGroup(invs, remember_generators=True): @@ -202,7 +201,7 @@ def _repr_(self) -> str: # since we want to inherit things like __hash__ from there rather than the # hyper-generic implementation for abstract abelian groups. -class AdditiveAbelianGroup_class(FGP_Module_class, Parent): +class AdditiveAbelianGroup_class(FGP_Module_class): r""" An additive abelian group, implemented using the `\ZZ`-module machinery. @@ -224,9 +223,12 @@ def __init__(self, cover, relations): Additive abelian group isomorphic to Z sage: G == loads(dumps(G)) True + sage: G.category() + Category of modules over Integer Ring + sage: G in CommutativeAdditiveGroups() + True """ FGP_Module_class.__init__(self, cover, relations) - Parent.__init__(self, category=CommutativeAdditiveGroups()) def _repr_(self): r""" diff --git a/src/sage/groups/group.pyx b/src/sage/groups/group.pyx index fdfe79bd9eb..8fa6d3dec3c 100644 --- a/src/sage/groups/group.pyx +++ b/src/sage/groups/group.pyx @@ -16,12 +16,12 @@ Base class for groups # # https://www.gnu.org/licenses/ # **************************************************************************** - -from sage.structure.parent cimport Parent +from sage.misc.superseded import deprecation from sage.rings.infinity import infinity +from sage.structure.parent cimport Parent -def is_Group(x) -> bool: +def is_Group(x): """ Return whether ``x`` is a group object. @@ -38,10 +38,13 @@ def is_Group(x) -> bool: sage: F. = FreeGroup() # needs sage.groups sage: from sage.groups.group import is_Group sage: is_Group(F) # needs sage.groups + doctest:warning...DeprecationWarning: use instead G in Groups() + See https://github.com/sagemath/sage/issues/37449 for details. True sage: is_Group("a string") False """ + deprecation(37449, 'use instead G in Groups()') return isinstance(x, Group) diff --git a/src/sage/groups/old.pyx b/src/sage/groups/old.pyx index 43b63062c84..2d76c9bc66d 100644 --- a/src/sage/groups/old.pyx +++ b/src/sage/groups/old.pyx @@ -1,5 +1,5 @@ """ -Deprecated Base class for groups +Deprecated base class for groups """ # **************************************************************************** @@ -18,7 +18,7 @@ Deprecated Base class for groups # **************************************************************************** doc = """ -Deprecated Base class for all groups +Deprecated base class for all groups """ import sage.rings.integer_ring from sage.misc.superseded import deprecation