Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate is_AbelianGroup, is_DualAbelianGroup, is_MatrixGroup #37898

Merged
merged 3 commits into from
May 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
src/sage/groups/matrix_gps/matrix_group.py: Deprecate is_MatrixGroup
Matthias Koeppe committed May 8, 2024

Verified

This commit was signed with the committer’s verified signature.
mcollina Matteo Collina
commit ec586f290f85a33dd5e6c242d48119f9c1b240b8
8 changes: 7 additions & 1 deletion src/sage/groups/matrix_gps/matrix_group.py
Original file line number Diff line number Diff line change
@@ -78,6 +78,10 @@ def is_MatrixGroup(x):
sage: from sage.groups.matrix_gps.matrix_group import is_MatrixGroup
sage: is_MatrixGroup(MatrixSpace(QQ, 3))
doctest:warning...
DeprecationWarning: the function is_MatrixGroup is deprecated;
use 'isinstance(..., MatrixGroup_base)' instead
See https://github.com/sagemath/sage/issues/37898 for details.
False
sage: is_MatrixGroup(Mat(QQ, 3))
False
@@ -86,6 +90,8 @@ def is_MatrixGroup(x):
sage: is_MatrixGroup(MatrixGroup([matrix(2, [1,1,0,1])]))
True
"""
from sage.misc.superseded import deprecation
deprecation(37898, "the function is_MatrixGroup is deprecated; use 'isinstance(..., MatrixGroup_base)' instead")
return isinstance(x, MatrixGroup_base)

###################################################################
@@ -499,7 +505,7 @@ def __richcmp__(self, other, op):
sage: G != H
False
"""
if not is_MatrixGroup(other):
if not isinstance(other, MatrixGroup_base):
return NotImplemented

if self is other:
11 changes: 3 additions & 8 deletions src/sage/matrix/matrix_space.py
Original file line number Diff line number Diff line change
@@ -58,6 +58,7 @@
from sage.features import PythonModule
lazy_import('sage.matrix.matrix_gfpn_dense', ['Matrix_gfpn_dense'],
feature=PythonModule('sage.matrix.matrix_gfpn_dense', spkg='meataxe'))
lazy_import('sage.groups.matrix_gps.matrix_group', ['MatrixGroup_base'])

_Rings = Rings()
_Fields = Fields()
@@ -1392,14 +1393,8 @@ def _coerce_map_from_(self, S):
pass
else:
MS = meth_matrix_space()

try:
from sage.groups.matrix_gps.matrix_group import is_MatrixGroup
except ImportError:
pass
else:
if is_MatrixGroup(S):
return self.has_coerce_map_from(MS)
if isinstance(S, MatrixGroup_base):
return self.has_coerce_map_from(MS)

try:
from sage.modular.arithgroup.arithgroup_generic import is_ArithmeticSubgroup
4 changes: 2 additions & 2 deletions src/sage/modular/arithgroup/congroup_generic.py
Original file line number Diff line number Diff line change
@@ -89,9 +89,9 @@ def CongruenceSubgroup_constructor(*args):
TypeError: Ring of definition must be Z / NZ for some N
"""
from sage.groups.matrix_gps.finitely_generated import MatrixGroup
from sage.groups.matrix_gps.matrix_group import is_MatrixGroup
from sage.groups.matrix_gps.matrix_group import MatrixGroup_base

if is_MatrixGroup(args[0]):
if isinstance(args[0], MatrixGroup_base):
G = args[0]

elif isinstance(args[0], list):

Unchanged files with check annotations Beta

sage: pi_def = gp(pi); pi_def
3.141592653589793238462643383 # 32-bit
3.1415926535897932384626433832795028842 # 64-bit
sage: pi_def.precision()

Check warning on line 799 in src/sage/interfaces/gp.py

GitHub Actions / test-long

Warning: Variable 'pi_def' referenced here was set only in doctest marked '# needs sage.libs.pari sage.symbolic'

Variable 'pi_def' referenced here was set only in doctest marked '# needs sage.libs.pari sage.symbolic'
28 # 32-bit
38 # 64-bit
sage: pi_150 = gp.new_with_bits_prec(pi, 150)
sage: b.dtype
dtype('int32') # 32-bit
dtype('int64') # 64-bit
sage: b.shape

Check warning on line 729 in src/sage/matrix/matrix1.pyx

GitHub Actions / test-long

Warning: Variable 'b' referenced here was set only in doctest marked '# needs numpy'

Variable 'b' referenced here was set only in doctest marked '# needs numpy'
(3, 4)
"""
import numpy