Skip to content

Commit 06ad18b

Browse files
committed
remove one deprecation in schemes
1 parent 4e2319b commit 06ad18b

File tree

1 file changed

+21
-27
lines changed

1 file changed

+21
-27
lines changed

src/sage/schemes/projective/projective_morphism.py

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ class SchemeMorphism_polynomial_projective_space(SchemeMorphism_polynomial):
187187
y,
188188
x
189189
"""
190-
def __init__(self, parent, polys, check=True):
190+
def __init__(self, parent, polys, check=True) -> None:
191191
"""
192192
Initialize.
193193
@@ -557,7 +557,7 @@ def __eq__(self, right):
557557
return all(self._polys[i] * right._polys[j] == self._polys[j] * right._polys[i]
558558
for i in range(n) for j in range(i + 1, n))
559559

560-
def __ne__(self, right):
560+
def __ne__(self, right) -> bool:
561561
"""
562562
Test the inequality of two projective morphisms.
563563
@@ -961,7 +961,7 @@ def normalize_coordinates(self, **kwds):
961961
ideal = ZZ(ideal)
962962
if self.base_ring() != QQ:
963963
raise ValueError('ideal was an integer, but the base ring of this ' +
964-
'morphism is %s' % self.base_ring())
964+
'morphism is %s' % self.base_ring())
965965
if not ideal.is_prime():
966966
raise ValueError('ideal must be a prime, not %s' % ideal)
967967
uniformizer = ideal
@@ -980,7 +980,7 @@ def normalize_coordinates(self, **kwds):
980980
raise TypeError('valuation must be a valuation on a number field, not %s' % valuation)
981981
if valuation.domain() != self.base_ring():
982982
raise ValueError('the domain of valuation must be the base ring of this morphism ' +
983-
'not %s' % valuation.domain())
983+
'not %s' % valuation.domain())
984984
uniformizer = valuation.uniformizer()
985985
ramification_index = 1 / valuation(uniformizer)
986986
valuations = []
@@ -1805,7 +1805,7 @@ def _number_field_from_algebraics(self):
18051805
for t in exps:
18061806
G = 0
18071807
for e in t:
1808-
G += C[j]*prod([R.gen(i)**e[i] for i in range(N+1)])
1808+
G += C[j] * prod([R.gen(i)**e[i] for i in range(N + 1)])
18091809
j += 1
18101810
F.append(G)
18111811
return H(F)
@@ -1888,8 +1888,6 @@ def indeterminacy_locus(self):
18881888
sage: H = End(P)
18891889
sage: f = H([x^2, y^2, z^2])
18901890
sage: f.indeterminacy_locus() # needs sage.libs.singular
1891-
... DeprecationWarning: The meaning of indeterminacy_locus() has changed.
1892-
Read the docstring. See https://github.com/sagemath/sage/issues/29145 for details.
18931891
Closed subscheme of Projective Space of dimension 2 over Rational Field defined by:
18941892
z,
18951893
y,
@@ -1905,7 +1903,7 @@ def indeterminacy_locus(self):
19051903
z,
19061904
x^2 - y^2
19071905
1908-
There is related :meth:`base_indeterminacy_locus()` method. This
1906+
There is a related :meth:`base_indeterminacy_locus()` method. This
19091907
computes the indeterminacy locus only from the defining polynomials of
19101908
the map::
19111909
@@ -1918,11 +1916,9 @@ def indeterminacy_locus(self):
19181916
x^2 - y^2,
19191917
z^2
19201918
"""
1921-
from sage.misc.superseded import deprecation
1922-
deprecation(29145, "The meaning of indeterminacy_locus() has changed. Read the docstring.")
19231919
P = self.domain()
19241920
X = P.subscheme(0) # projective space as a subscheme
1925-
return (self*X.hom(P.gens(), P)).indeterminacy_locus()
1921+
return (self * X.hom(P.gens(), P)).indeterminacy_locus()
19261922

19271923
def indeterminacy_points(self, F=None, base=False):
19281924
r"""
@@ -1944,8 +1940,6 @@ def indeterminacy_points(self, F=None, base=False):
19441940
sage: H = End(P)
19451941
sage: f = H([x*z - y*z, x^2 - y^2, z^2])
19461942
sage: f.indeterminacy_points() # needs sage.libs.singular
1947-
... DeprecationWarning: The meaning of indeterminacy_locus() has changed.
1948-
Read the docstring. See https://github.com/sagemath/sage/issues/29145 for details.
19491943
[(-1 : 1 : 0), (1 : 1 : 0)]
19501944
19511945
::
@@ -2114,7 +2108,7 @@ def reduce_base_field(self):
21142108
if K in NumberFields() or isinstance(K, sage.rings.abc.AlgebraicField):
21152109
return self._number_field_from_algebraics()
21162110
if K in FiniteFields():
2117-
#find the degree of the extension containing the coefficients
2111+
# find the degree of the extension containing the coefficients
21182112
c = [v for g in self for v in g.coefficients()]
21192113
d = lcm([a.minpoly().degree() for a in c])
21202114
if d == 1:
@@ -2138,7 +2132,7 @@ def reduce_base_field(self):
21382132
self.domain().variable_names())
21392133
new_R = new_domain.coordinate_ring()
21402134
u = phi(L.gen()) # gen of L in terms of gen of K
2141-
g = R(str(u).replace(K.variable_name(), R.variable_names()[0])) #converted to R
2135+
g = R(str(u).replace(K.variable_name(), R.variable_names()[0])) # converted to R
21422136
new_f = []
21432137
for fi in self:
21442138
mon = fi.monomials()
@@ -2148,17 +2142,17 @@ def reduce_base_field(self):
21482142
for c in coef:
21492143
# for each coefficient do the elimination
21502144
w = R(str(c).replace(K.variable_name(), R.variable_names()[0]))
2151-
I = R.ideal([b-g, w])
2145+
I = R.ideal([b - g, w])
21522146
v = I.elimination_ideal([a]).gen(0)
21532147
# elimination can change scale the result, so correct the leading coefficient
21542148
# and convert back to L
2155-
if v.subs({b:g}).lc() == w.lc():
2149+
if v.subs({b: g}).lc() == w.lc():
21562150
new_c.append(L(str(v).replace(R.variable_names()[1], L.variable_name())))
21572151
else:
2158-
new_c.append(L(str(w.lc()*v).replace(R.variable_names()[1], L.variable_name())))
2152+
new_c.append(L(str(w.lc() * v).replace(R.variable_names()[1], L.variable_name())))
21592153
# reconstruct as a poly in the new domain
2160-
new_f.append(sum(new_c[i]*prod(new_R.gen(j)**mon_deg[i][j]
2161-
for j in range(new_R.ngens()))
2154+
new_f.append(sum(new_c[i] * prod(new_R.gen(j)**mon_deg[i][j]
2155+
for j in range(new_R.ngens()))
21622156
for i in range(len(mon))))
21632157
# return the correct type of map
21642158
if self.is_endomorphism():
@@ -2194,7 +2188,7 @@ def reduce_base_field(self):
21942188
if M.degree() == da:
21952189
break
21962190
c = M(str(c).replace(c.as_finite_field_element()[0].variable_name(),
2197-
M.variable_name()))
2191+
M.variable_name()))
21982192
new_c.append(M_to_L(c))
21992193
# reconstruct as a poly in the new domain
22002194
new_f.append(sum([new_c[i] * prod(new_R.gen(j)**mon_deg[i][j]
@@ -2238,7 +2232,7 @@ def image(self):
22382232
"""
22392233
X = self.domain().subscheme(0)
22402234
e = X.embedding_morphism()
2241-
return (self*e).image()
2235+
return (self * e).image()
22422236

22432237

22442238
class SchemeMorphism_polynomial_projective_space_finite_field(SchemeMorphism_polynomial_projective_space_field):
@@ -2305,7 +2299,7 @@ def __call__(self, x):
23052299
pass
23062300
raise ValueError('the morphism is not defined at this point')
23072301

2308-
def __eq__(self, other):
2302+
def __eq__(self, other) -> bool:
23092303
"""
23102304
EXAMPLES::
23112305
@@ -2435,7 +2429,7 @@ def representatives(self):
24352429
emb = Y.projective_embedding(0)
24362430
hom = self.parent()
24372431
reprs = []
2438-
for r in (emb*self).representatives():
2432+
for r in (emb * self).representatives():
24392433
f0 = r[0]
24402434
reprs.append(hom([f / f0 for f in r[1:]]))
24412435
return reprs
@@ -2566,7 +2560,7 @@ def indeterminacy_locus(self):
25662560
components = X.irreducible_components()
25672561

25682562
def self_with_domain(C):
2569-
return self*C.hom(Amb.gens(), X)
2563+
return self * C.hom(Amb.gens(), X)
25702564

25712565
locus = self_with_domain(components[0]).indeterminacy_locus()
25722566
for C in components[1:]:
@@ -2647,13 +2641,13 @@ def image(self):
26472641
D = PolynomialRing(k, names=dummy_names)
26482642

26492643
names = list(S.variable_names()) + dummy_names # this order of variables is important
2650-
R = PolynomialRing(k, names=names, order='degrevlex({}),degrevlex({})'.format(m,n))
2644+
R = PolynomialRing(k, names=names, order='degrevlex({}),degrevlex({})'.format(m, n))
26512645

26522646
# compute the ideal of the image by elimination
26532647
i = R.ideal(list(X.defining_ideal().gens()) + [self._polys[i] - R.gen(n + i) for i in range(m)])
26542648
j = [g for g in i.groebner_basis() if g in D]
26552649

2656-
gens = [g.subs(dict(zip(R.gens()[n:],T.gens()))) for g in j]
2650+
gens = [g.subs(dict(zip(R.gens()[n:], T.gens()))) for g in j]
26572651
return AY.subscheme(gens)
26582652

26592653
@cached_method

0 commit comments

Comments
 (0)