Skip to content

Commit ec586f2

Browse files
author
Matthias Koeppe
committed
src/sage/groups/matrix_gps/matrix_group.py: Deprecate is_MatrixGroup
1 parent c0b4cd5 commit ec586f2

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

src/sage/groups/matrix_gps/matrix_group.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ def is_MatrixGroup(x):
7878
7979
sage: from sage.groups.matrix_gps.matrix_group import is_MatrixGroup
8080
sage: is_MatrixGroup(MatrixSpace(QQ, 3))
81+
doctest:warning...
82+
DeprecationWarning: the function is_MatrixGroup is deprecated;
83+
use 'isinstance(..., MatrixGroup_base)' instead
84+
See https://github.com/sagemath/sage/issues/37898 for details.
8185
False
8286
sage: is_MatrixGroup(Mat(QQ, 3))
8387
False
@@ -86,6 +90,8 @@ def is_MatrixGroup(x):
8690
sage: is_MatrixGroup(MatrixGroup([matrix(2, [1,1,0,1])]))
8791
True
8892
"""
93+
from sage.misc.superseded import deprecation
94+
deprecation(37898, "the function is_MatrixGroup is deprecated; use 'isinstance(..., MatrixGroup_base)' instead")
8995
return isinstance(x, MatrixGroup_base)
9096

9197
###################################################################
@@ -499,7 +505,7 @@ def __richcmp__(self, other, op):
499505
sage: G != H
500506
False
501507
"""
502-
if not is_MatrixGroup(other):
508+
if not isinstance(other, MatrixGroup_base):
503509
return NotImplemented
504510

505511
if self is other:

src/sage/matrix/matrix_space.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
from sage.features import PythonModule
5959
lazy_import('sage.matrix.matrix_gfpn_dense', ['Matrix_gfpn_dense'],
6060
feature=PythonModule('sage.matrix.matrix_gfpn_dense', spkg='meataxe'))
61+
lazy_import('sage.groups.matrix_gps.matrix_group', ['MatrixGroup_base'])
6162

6263
_Rings = Rings()
6364
_Fields = Fields()
@@ -1392,14 +1393,8 @@ def _coerce_map_from_(self, S):
13921393
pass
13931394
else:
13941395
MS = meth_matrix_space()
1395-
1396-
try:
1397-
from sage.groups.matrix_gps.matrix_group import is_MatrixGroup
1398-
except ImportError:
1399-
pass
1400-
else:
1401-
if is_MatrixGroup(S):
1402-
return self.has_coerce_map_from(MS)
1396+
if isinstance(S, MatrixGroup_base):
1397+
return self.has_coerce_map_from(MS)
14031398

14041399
try:
14051400
from sage.modular.arithgroup.arithgroup_generic import is_ArithmeticSubgroup

src/sage/modular/arithgroup/congroup_generic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ def CongruenceSubgroup_constructor(*args):
8989
TypeError: Ring of definition must be Z / NZ for some N
9090
"""
9191
from sage.groups.matrix_gps.finitely_generated import MatrixGroup
92-
from sage.groups.matrix_gps.matrix_group import is_MatrixGroup
92+
from sage.groups.matrix_gps.matrix_group import MatrixGroup_base
9393

94-
if is_MatrixGroup(args[0]):
94+
if isinstance(args[0], MatrixGroup_base):
9595
G = args[0]
9696

9797
elif isinstance(args[0], list):

0 commit comments

Comments
 (0)