Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit d5541fe

Browse files
committed
Merge branch 'u/chapoton/34342' in 9.7.rc0
2 parents cae9ee5 + bae3378 commit d5541fe

File tree

8 files changed

+120
-112
lines changed

8 files changed

+120
-112
lines changed

build/pkgs/matplotlib/make-setup-config.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from configparser import ConfigParser
2-
import pkgconfig
32
import os
43

54
config = ConfigParser()
@@ -23,7 +22,7 @@
2322

2423
print("NOTE: Set SAGE_MATPLOTLIB_GUI to anything but 'no' to try to build the Matplotlib GUI.")
2524

26-
graphical_backend='False'
25+
graphical_backend = 'False'
2726
if os.environ.get('SAGE_MATPLOTLIB_GUI', 'no').lower() != 'no':
2827
graphical_backend = 'auto'
2928

@@ -35,7 +34,7 @@
3534

3635
config.add_section('gui_support')
3736
for backend in ('gtk', 'gtkagg', 'tkagg', 'wxagg', 'macosx', 'windowing'):
38-
config.set('gui_support', backend, graphical_backend)
37+
config.set('gui_support', backend, graphical_backend)
3938

4039
with open('src/mplsetup.cfg', 'w') as configfile:
4140
config.write(configfile)

src/sage/algebras/quatalg/quaternion_algebra.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -2690,15 +2690,13 @@ def multiply_by_conjugate(self, J):
26902690
R = self.quaternion_algebra()
26912691
return R.ideal(basis, check=False)
26922692

2693-
def is_equivalent(I, J, B=10):
2693+
def is_equivalent(self, J, B=10) -> bool:
26942694
"""
2695-
Return ``True`` if ``I`` and ``J`` are equivalent as right ideals.
2695+
Return ``True`` if ``self`` and ``J`` are equivalent as right ideals.
26962696
26972697
INPUT:
26982698
2699-
- ``I`` -- a fractional quaternion ideal (self)
2700-
2701-
- ``J`` -- a fractional quaternion ideal with same order as ``I``
2699+
- ``J`` -- a fractional quaternion ideal with same order as ``self``
27022700
27032701
- ``B`` -- a bound to compute and compare theta series before
27042702
doing the full equivalence test
@@ -2718,23 +2716,24 @@ def is_equivalent(I, J, B=10):
27182716
sage: R[0].is_equivalent(S)
27192717
True
27202718
"""
2721-
if not isinstance(I, QuaternionFractionalIdeal_rational):
2719+
# shorthand: let I be self
2720+
if not isinstance(self, QuaternionFractionalIdeal_rational):
27222721
return False
27232722

2724-
if I.right_order() != J.right_order():
2725-
raise ValueError("I and J must be right ideals")
2723+
if self.right_order() != J.right_order():
2724+
raise ValueError("self and J must be right ideals")
27262725

27272726
# Just test theta series first. If the theta series are
27282727
# different, the ideals are definitely not equivalent.
2729-
if B > 0 and I.theta_series_vector(B) != J.theta_series_vector(B):
2728+
if B > 0 and self.theta_series_vector(B) != J.theta_series_vector(B):
27302729
return False
27312730

27322731
# The theta series are the same, so perhaps the ideals are
27332732
# equivalent. We use Prop 1.18 of [Pizer, 1980] to decide.
27342733
# 1. Compute I * Jbar
27352734
# see Prop. 1.17 in Pizer. Note that we use IJbar instead of
27362735
# JbarI since we work with right ideals
2737-
IJbar = I.multiply_by_conjugate(J)
2736+
IJbar = self.multiply_by_conjugate(J)
27382737

27392738
# 2. Determine if there is alpha in K such
27402739
# that N(alpha) = N(I)*N(J) as explained by Pizer.

src/sage/functions/log.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -1243,6 +1243,7 @@ def _print_latex_(self, z, m):
12431243

12441244
harmonic_number = Function_harmonic_number_generalized()
12451245

1246+
12461247
class _Function_swap_harmonic(BuiltinFunction):
12471248
r"""
12481249
Harmonic number function with swapped arguments. For internal use only.
@@ -1262,14 +1263,18 @@ class _Function_swap_harmonic(BuiltinFunction):
12621263
"""
12631264
def __init__(self):
12641265
BuiltinFunction.__init__(self, "_swap_harmonic", nargs=2)
1266+
12651267
def _eval_(self, a, b, **kwds):
1266-
return harmonic_number(b,a,**kwds)
1268+
return harmonic_number(b, a, **kwds)
1269+
12671270

12681271
_swap_harmonic = _Function_swap_harmonic()
12691272

1273+
12701274
register_symbol(_swap_harmonic, {'maxima': 'gen_harmonic_number'})
12711275
register_symbol(_swap_harmonic, {'maple': 'harmonic'})
12721276

1277+
12731278
class Function_harmonic_number(BuiltinFunction):
12741279
r"""
12751280
Harmonic number function, defined by:

src/sage/groups/abelian_gps/dual_abelian_group.py

+10-11
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,10 @@
6363
# http://www.gnu.org/licenses/
6464
###########################################################################
6565

66-
from sage.rings.infinity import infinity
6766
from sage.structure.category_object import normalize_names
6867
from sage.structure.unique_representation import UniqueRepresentation
6968
from sage.groups.abelian_gps.dual_abelian_group_element import (
70-
DualAbelianGroupElement, is_DualAbelianGroupElement )
69+
DualAbelianGroupElement, is_DualAbelianGroupElement)
7170
from sage.misc.mrange import mrange
7271
from sage.misc.cachefunc import cached_method
7372
from sage.groups.group import AbelianGroup as AbelianGroupBase
@@ -126,7 +125,7 @@ def __init__(self, G, names, base_ring):
126125
self._group = G
127126
names = normalize_names(G.ngens(), names)
128127
self._assign_names(names)
129-
AbelianGroupBase.__init__(self) # TODO: category=CommutativeGroups()
128+
AbelianGroupBase.__init__(self) # TODO: category=CommutativeGroups()
130129

131130
def group(self):
132131
"""
@@ -165,7 +164,7 @@ def __str__(self):
165164
sage: print(Fd)
166165
DualAbelianGroup( AbelianGroup ( 3, (5, 64, 729) ) )
167166
"""
168-
s = "DualAbelianGroup( AbelianGroup ( %s, %s ) )"%(self.ngens(), self.gens_orders())
167+
s = "DualAbelianGroup( AbelianGroup ( %s, %s ) )" % (self.ngens(), self.gens_orders())
169168
return s
170169

171170
def _repr_(self):
@@ -188,9 +187,9 @@ def _repr_(self):
188187
eldv = G.gens_orders()
189188
gp = ""
190189
for x in eldv:
191-
if x!=0:
192-
gp = gp + "Z/%sZ x "%x
193-
if x==0:
190+
if x != 0:
191+
gp = gp + "Z/%sZ x " % x
192+
if x == 0:
194193
gp = gp + "Z x "
195194
gp = gp[:-2].strip()
196195
s = 'Dual of Abelian Group isomorphic to ' + gp + ' over ' + str(self.base_ring())
@@ -235,7 +234,7 @@ def random_element(self):
235234
result = self.one()
236235
for g in self.gens():
237236
order = g.order()
238-
result *= g**(randint(0,order))
237+
result *= g**(randint(0, order))
239238
return result
240239

241240
def gen(self, i=0):
@@ -255,8 +254,8 @@ def gen(self, i=0):
255254
"""
256255
n = self.group().ngens()
257256
if i < 0 or i >= n:
258-
raise IndexError("Argument i (= %s) must be between 0 and %s."%(i, n-1))
259-
x = [0]*n
257+
raise IndexError("Argument i (= %s) must be between 0 and %s." % (i, n - 1))
258+
x = [0] * n
260259
if self.gens_orders()[i] != 1:
261260
x[i] = 1
262261
return self.element_class(self, x)
@@ -324,7 +323,7 @@ def invariants(self):
324323
# TODO: deprecate
325324
return self.group().gens_orders()
326325

327-
def __contains__(self,X):
326+
def __contains__(self, X):
328327
"""
329328
Implements "in".
330329

src/sage/interfaces/ecm.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@
4646
# Distributed under the terms of the GNU General Public License (GPL)
4747
# as published by the Free Software Foundation; either version 3 of
4848
# the License, or (at your option) any later version.
49-
# http://www.gnu.org/licenses/
49+
# https://www.gnu.org/licenses/
5050
###############################################################################
5151

5252
import re
53-
import subprocess
53+
from subprocess import Popen, PIPE, call
5454

5555
from sage.structure.sage_object import SageObject
5656
from sage.rings.integer_ring import ZZ
@@ -216,8 +216,6 @@ def _run_ecm(self, cmd, n):
216216
sage: ecm._run_ecm(['cat'], 1234)
217217
'1234'
218218
"""
219-
from subprocess import Popen, PIPE
220-
221219
# Under normal usage this program only returns ASCII; anything
222220
# else mixed is garbage and an error
223221
# So just accept latin-1 without encoding errors, and let the
@@ -261,7 +259,7 @@ def interact(self):
261259
"""
262260
print("Enter numbers to run ECM on them.")
263261
print("Press control-D to exit.")
264-
subprocess.call(self._cmd)
262+
call(self._cmd)
265263

266264
# Recommended settings from
267265
# http://www.mersennewiki.org/index.php/Elliptic_Curve_Method
@@ -661,7 +659,7 @@ def factor(self, n, factor_digits=None, B1=2000, proof=False, **kwds):
661659
# Step 3: Call find_factor until a factorization is found
662660
n_factorization = [n]
663661
while len(n_factorization) == 1:
664-
n_factorization = self.find_factor(n,B1=B1)
662+
n_factorization = self.find_factor(n, B1=B1)
665663
factors.extend(n_factorization)
666664

667665
return sorted(probable_prime_factors)

src/sage/modules/quotient_module.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@
1919
# https://www.gnu.org/licenses/
2020
# ****************************************************************************
2121

22-
from sage.structure.richcmp import rich_to_bool, richcmp
23-
2422
from .free_module import (Module_free_ambient,
2523
FreeModule_ambient,
2624
FreeModule_ambient_field)
2725

26+
2827
###############################################################################
2928
#
3029
# Quotients of ambient free modules over a domain
@@ -80,7 +79,7 @@ def __init__(self, module, sub):
8079
v = [C(self._free_cover, x.list(), coerce=False, copy=False) for x in sub.gens()]
8180
w = [C(self._free_cover, x.list(), coerce=False, copy=False) for x in module.free_relations().gens()]
8281
self._relations = self._free_cover.submodule(v + w, check=False)
83-
else: # Otherwise module should be a free module
82+
else: # Otherwise module should be a free module
8483
self._free_cover = module
8584
self._relations = sub
8685

@@ -448,7 +447,7 @@ def _repr_(self):
448447
sage: Q._repr_()
449448
'Vector space quotient V/W of dimension 1 over Finite Field in a of size 3^2 where\nV: Vector space of degree 3 and dimension 2 over Finite Field in a of size 3^2\nUser basis matrix:\n[1 0 a]\n[a a 1]\nW: Vector space of degree 3 and dimension 1 over Finite Field in a of size 3^2\nBasis matrix:\n[ 1 1 a + 2]'
450449
"""
451-
return "%s space quotient V/W of dimension %s over %s where\nV: %s\nW: %s"%(
450+
return "%s space quotient V/W of dimension %s over %s where\nV: %s\nW: %s" % (
452451
"Sparse vector" if self.is_sparse() else "Vector",
453452
self.dimension(), self.base_ring(),
454453
self.V(), self.W())
@@ -675,4 +674,3 @@ def relations(self):
675674
return self._sub
676675

677676
W = relations
678-

0 commit comments

Comments
 (0)