Skip to content

Commit 8327845

Browse files
author
Release Manager
committed
gh-36413: various details in schemes This is fixing a few details as suggested by ruff. ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. URL: #36413 Reported by: Frédéric Chapoton Reviewer(s): David Coudert
2 parents cfc289b + 6485da7 commit 8327845

File tree

16 files changed

+26
-27
lines changed

16 files changed

+26
-27
lines changed

src/sage/schemes/affine/affine_subscheme.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ def multiplicity(self, P):
484484
sage: X.multiplicity(Q) # needs sage.libs.singular
485485
1
486486
"""
487-
if not self.base_ring() in Fields():
487+
if self.base_ring() not in Fields():
488488
raise TypeError("subscheme must be defined over a field")
489489

490490
# check whether P is a point on this subscheme

src/sage/schemes/curves/closed_point.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ def affine(self, i=None):
418418
ideal = self.prime_ideal()
419419
if i is None:
420420
for j in range(P.ngens()):
421-
if not P.gen(j) in ideal:
421+
if P.gen(j) not in ideal:
422422
i = j
423423
break
424424
else:

src/sage/schemes/curves/curve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ def singular_points(self, F=None):
340340
(b^6 : -b^6 : 1)]
341341
"""
342342
if F is None:
343-
if not self.base_ring() in Fields():
343+
if self.base_ring() not in Fields():
344344
raise TypeError("curve must be defined over a field")
345345
F = self.base_ring()
346346
elif F not in Fields():

src/sage/schemes/elliptic_curves/cm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def hilbert_class_polynomial(D, algorithm=None):
113113
D = Integer(D)
114114
if D >= 0:
115115
raise ValueError("D (=%s) must be negative" % D)
116-
if not (D % 4 in [0, 1]):
116+
if (D % 4) not in [0, 1]:
117117
raise ValueError("D (=%s) must be a discriminant" % D)
118118

119119
if algorithm == "arb":

src/sage/schemes/elliptic_curves/ell_number_field.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2510,7 +2510,7 @@ def real_components(self, embedding):
25102510
ValueError: invalid embedding specified: should have domain ...
25112511
"""
25122512
try:
2513-
if not embedding.domain() is self.base_field():
2513+
if embedding.domain() is not self.base_field():
25142514
raise ValueError("invalid embedding specified: should have domain {}".format(self.base_field()))
25152515
if not isinstance(embedding.codomain(), sage.rings.abc.RealField):
25162516
raise ValueError("invalid embedding specified: should be real")

src/sage/schemes/elliptic_curves/ell_point.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1931,7 +1931,7 @@ def tate_pairing(self, Q, n, k, q=None):
19311931
P = self
19321932
E = P.curve()
19331933

1934-
if not Q.curve() is E:
1934+
if Q.curve() is not E:
19351935
raise ValueError("Points must both be on the same curve")
19361936

19371937
K = E.base_ring()
@@ -2139,7 +2139,7 @@ def ate_pairing(self, Q, n, k, t, q=None):
21392139
# check for same curve
21402140
E = P.curve()
21412141
O = E(0)
2142-
if not Q.curve() is E:
2142+
if Q.curve() is not E:
21432143
raise ValueError("Points must both be on the same curve")
21442144

21452145
# set q to be the order of the base field

src/sage/schemes/elliptic_curves/ell_rational_field.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4987,7 +4987,7 @@ def is_isogenous(self, other, proof=True, maxp=200):
49874987
"""
49884988
if not is_EllipticCurve(other):
49894989
raise ValueError("Second argument is not an Elliptic Curve.")
4990-
if not other.base_field() is QQ:
4990+
if other.base_field() is not QQ:
49914991
raise ValueError("If first argument is an elliptic curve over QQ then the second argument must be also.")
49924992

49934993
if self.is_isomorphic(other):

src/sage/schemes/elliptic_curves/heegner.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,11 @@
118118
from sage.misc.verbose import verbose
119119
from sage.modular.modsym.p1list import P1List
120120
from sage.rings.complex_double import CDF
121-
from sage.rings.complex_mpfr import ComplexField
122121
from sage.rings.factorint import factor_trial_division
123122
from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF
124123
from sage.rings.finite_rings.integer_mod_ring import IntegerModRing as Integers
125124
from sage.rings.integer_ring import ZZ
126-
from sage.rings.number_field.number_field import QuadraticField
127125
from sage.rings.rational_field import QQ
128-
from sage.rings.real_mpfr import RealField
129126
from sage.quadratic_forms.binary_qf import BinaryQF
130127
from sage.quadratic_forms.binary_qf import BinaryQF_reduced_representatives
131128
from sage.rings.number_field.number_field_element_base import NumberFieldElement_base

src/sage/schemes/elliptic_curves/isogeny_class.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -406,17 +406,17 @@ def graph(self):
406406
"""
407407
from sage.graphs.graph import Graph
408408

409-
if not self.E.base_field() is QQ:
409+
if self.E.base_field() is not QQ:
410410
M = self.matrix(fill=False)
411411
n = len(self)
412412
G = Graph(M, format='weighted_adjacency_matrix')
413413
D = dict([(v,self.curves[v]) for v in G.vertices(sort=False)])
414414
G.set_vertices(D)
415-
if self._qfmat: # i.e. self.E.has_rational_cm():
415+
if self._qfmat: # i.e. self.E.has_rational_cm():
416416
for i in range(n):
417417
for j in range(n):
418-
if M[i,j]:
419-
G.set_edge_label(i,j,str(self._qfmat[i][j]))
418+
if M[i, j]:
419+
G.set_edge_label(i, j, str(self._qfmat[i][j]))
420420
G.relabel(list(range(1, n + 1)))
421421
return G
422422

src/sage/schemes/elliptic_curves/period_lattice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1707,7 +1707,7 @@ def elliptic_logarithm(self, P, prec=None, reduce=True):
17071707
sage: L.elliptic_logarithm(P, prec=1000)
17081708
1.17058357737548897849026170185581196033579563441850967539191867385734983296504066660506637438866628981886518901958717288150400849746892393771983141354014895386251320571643977497740116710952913769943240797618468987304985625823413440999754037939123032233879499904283600304184828809773650066658885672885 - 1.13513899565966043682474529757126359416758251309237866586896869548539516543734207347695898664875799307727928332953834601460994992792519799260968053875387282656993476491590607092182964878750169490985439873220720963653658829712494879003124071110818175013453207439440032582917366703476398880865439217473*I
17091709
"""
1710-
if not P.curve() is self.E:
1710+
if P.curve() is not self.E:
17111711
raise ValueError("Point is on the wrong curve")
17121712
if prec is None:
17131713
prec = RealField().precision()

0 commit comments

Comments
 (0)