Skip to content

Commit f7d9619

Browse files
author
Matthias Koeppe
committed
src/sage/schemes: Deprecate is_... functions
1 parent ffbbea9 commit f7d9619

File tree

17 files changed

+42
-0
lines changed

17 files changed

+42
-0
lines changed

src/sage/schemes/affine/affine_space.py

+2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ def is_AffineSpace(x) -> bool:
5252
sage: is_AffineSpace(Spec(ZZ))
5353
False
5454
"""
55+
from sage.misc.superseded import deprecation
56+
deprecation(38022, "the function is_AffineSpace is deprecated; use 'isinstance(..., AffineSpace_generic)' instead")
5557
return isinstance(x, AffineSpace_generic)
5658

5759

src/sage/schemes/berkovich/berkovich_space.py

+4
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ def is_Berkovich(space) -> bool:
6262
sage: is_Berkovich(B)
6363
True
6464
"""
65+
from sage.misc.superseded import deprecation
66+
deprecation(38022, "the function is_Berkovich is deprecated; use 'isinstance(..., Berkovich)' instead")
6567
return isinstance(space, Berkovich)
6668

6769

@@ -81,6 +83,8 @@ def is_Berkovich_Cp(space) -> bool:
8183
sage: is_Berkovich(B)
8284
True
8385
"""
86+
from sage.misc.superseded import deprecation
87+
deprecation(38022, "the function is_Berkovich_Cp is deprecated; use 'isinstance(..., Berkovich_Cp)' instead")
8488
return isinstance(space, Berkovich_Cp)
8589

8690

src/sage/schemes/elliptic_curves/ell_generic.py

+2
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ def is_EllipticCurve(x):
102102
sage: is_EllipticCurve(0)
103103
False
104104
"""
105+
from sage.misc.superseded import deprecation
106+
deprecation(38022, "the function is_EllipticCurve is deprecated; use 'isinstance(..., EllipticCurve_generic)' instead")
105107
return isinstance(x, EllipticCurve_generic)
106108

107109

src/sage/schemes/generic/algebraic_scheme.py

+2
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ def is_AlgebraicScheme(x):
190190
sage: is_AlgebraicScheme(S)
191191
False
192192
"""
193+
from sage.misc.superseded import deprecation
194+
deprecation(38022, "the function is_AlgebraicScheme is deprecated; use 'isinstance(..., AlgebraicScheme)' instead")
193195
return isinstance(x, AlgebraicScheme)
194196

195197

src/sage/schemes/generic/ambient_space.py

+3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ def is_AmbientSpace(x):
3232
sage: is_AmbientSpace(P.subscheme([x + y + z]))
3333
False
3434
"""
35+
from sage.misc.superseded import deprecation
36+
deprecation(38022, "the function is_AmbientSpace is deprecated; use 'isinstance(..., AmbientSpace)' instead")
3537
return isinstance(x, AmbientSpace)
3638

39+
3740
class AmbientSpace(Scheme):
3841
"""
3942
Base class for ambient spaces over a ring.

src/sage/schemes/generic/divisor_group.py

+2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ def is_DivisorGroup(x):
7979
sage: is_DivisorGroup('not a divisor')
8080
False
8181
"""
82+
from sage.misc.superseded import deprecation
83+
deprecation(38022, "the function is_DivisorGroup is deprecated; use 'isinstance(..., DivisorGroup_generic)' instead")
8284
return isinstance(x, DivisorGroup_generic)
8385

8486

src/sage/schemes/generic/homset.py

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ def is_SchemeHomset(H):
7373
sage: is_SchemeHomset('a string')
7474
False
7575
"""
76+
from sage.misc.superseded import deprecation
77+
deprecation(38022, "the function is_SchemeHomset is deprecated; use 'isinstance(..., SchemeHomset_generic)' instead")
7678
return isinstance(H, SchemeHomset_generic)
7779

7880

src/sage/schemes/generic/hypersurface.py

+3
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@ def is_Hypersurface(self):
4848
sage: is_Hypersurface(H)
4949
False
5050
"""
51+
from sage.misc.superseded import deprecation
52+
deprecation(38022, "the function is_Hypersurface is deprecated; use 'isinstance(..., (ProjectiveHypersurface, AffineHypersurface))' instead")
5153
return isinstance(self, (ProjectiveHypersurface, AffineHypersurface))
5254

55+
5356
class ProjectiveHypersurface(AlgebraicScheme_subscheme_projective):
5457
"""
5558
The projective hypersurface defined by the given polynomial.

src/sage/schemes/generic/scheme.py

+5
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ def is_Scheme(x):
4949
sage: is_Scheme(X)
5050
True
5151
"""
52+
from sage.misc.superseded import deprecation
53+
deprecation(38022, "the function is_Scheme is deprecated; use 'isinstance(..., Scheme)' or categories instead")
5254
return isinstance(x, Scheme)
5355

5456

@@ -799,8 +801,11 @@ def is_AffineScheme(x):
799801
sage: is_AffineScheme(E)
800802
True
801803
"""
804+
from sage.misc.superseded import deprecation
805+
deprecation(38022, "the function is_AffineScheme is deprecated; use 'isinstance(..., AffineScheme)' instead")
802806
return isinstance(x, AffineScheme)
803807

808+
804809
class AffineScheme(UniqueRepresentation, Scheme):
805810
"""
806811
Class for general affine schemes.

src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ def is_HyperellipticCurve(C):
5353
sage: is_HyperellipticCurve(C)
5454
True
5555
"""
56+
from sage.misc.superseded import deprecation
57+
deprecation(38022, "the function is_HyperellipticCurve is deprecated; use 'isinstance(..., HyperellipticCurve_generic)' instead")
5658
return isinstance(C, HyperellipticCurve_generic)
5759

5860

src/sage/schemes/plane_quartics/quartic_generic.py

+3
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@ def is_QuarticCurve(C):
3434
True
3535
3636
"""
37+
from sage.misc.superseded import deprecation
38+
deprecation(38022, "the function is_QuarticCurve is deprecated; use 'isinstance(..., QuarticCurve_generic)' instead")
3739
return isinstance(C, QuarticCurve_generic)
3840

41+
3942
class QuarticCurve_generic(projective_curve.ProjectivePlaneCurve):
4043
# DRK: Note that we should check whether the curve is
4144

src/sage/schemes/product_projective/space.py

+2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ def is_ProductProjectiveSpaces(x):
7777
sage: is_ProductProjectiveSpaces(ProductProjectiveSpaces([1, 2, 3], ZZ, 'x'))
7878
True
7979
"""
80+
from sage.misc.superseded import deprecation
81+
deprecation(38022, "the function is_ProductProjectiveSpaces is deprecated; use 'isinstance(..., ProductProjectiveSpaces_ring)' instead")
8082
return isinstance(x, ProductProjectiveSpaces_ring)
8183

8284

src/sage/schemes/projective/projective_space.py

+2
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ def is_ProjectiveSpace(x):
146146
sage: is_ProjectiveSpace(Spec(ZZ))
147147
False
148148
"""
149+
from sage.misc.superseded import deprecation
150+
deprecation(38022, "the function is_ProjectiveSpace is deprecated; use 'isinstance(..., ProjectiveSpace_ring)' instead")
149151
return isinstance(x, ProjectiveSpace_ring)
150152

151153

src/sage/schemes/toric/chow_group.py

+2
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,8 @@ def is_ChowGroup(x) -> bool:
12201220
sage: is_ChowGroup('Victoria')
12211221
False
12221222
"""
1223+
from sage.misc.superseded import deprecation
1224+
deprecation(38022, "the function is_ChowGroup is deprecated; use 'isinstance(..., ChowGroup_class)' instead")
12231225
return isinstance(x, ChowGroup_class)
12241226

12251227

src/sage/schemes/toric/fano_variety.py

+2
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ def is_CPRFanoToricVariety(x):
179179
sage: is_CPRFanoToricVariety(ProjectiveSpace(2))
180180
False
181181
"""
182+
from sage.misc.superseded import deprecation
183+
deprecation(38022, "the function is_CPRFanoToricVariety is deprecated; use 'isinstance(..., CPRFanoToricVariety_field)' instead")
182184
return isinstance(x, CPRFanoToricVariety_field)
183185

184186

src/sage/schemes/toric/sheaf/klyachko.py

+2
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ def is_KlyachkoBundle(X):
7171
sage: is_KlyachkoBundle('test')
7272
False
7373
"""
74+
from sage.misc.superseded import deprecation
75+
deprecation(38022, "the function is_KlyachkoBundle is deprecated; use 'isinstance(..., KlyachkoBundle_class)' instead")
7476
return isinstance(X, KlyachkoBundle_class)
7577

7678

src/sage/schemes/toric/variety.py

+2
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,8 @@ def is_ToricVariety(x):
361361
sage: is_ToricVariety(ProjectiveSpace(2))
362362
False
363363
"""
364+
from sage.misc.superseded import deprecation
365+
deprecation(38022, "the function is_ToricVariety is deprecated; use 'isinstance(..., ToricVariety_field)' instead")
364366
return isinstance(x, ToricVariety_field)
365367

366368

0 commit comments

Comments
 (0)