Skip to content

Commit a493495

Browse files
author
Release Manager
committed
gh-35355: partial fix for E221 (to be continued) <!-- Please provide a concise, informative and self-explanatory title. --> <!-- Don't put issue numbers in the title. Put it in the Description below. --> <!-- For example, instead of "Fixes #12345", use "Add a new method to multiply two integers" --> ### 📚 Description Partial fix for pycodestyle E221, done using autopep8. E221 multiple spaces before operator <!-- Describe your changes here in detail. --> <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. It should be `[x]` not `[x ]`. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #35355 Reported by: Frédéric Chapoton Reviewer(s): Matthias Köppe
2 parents ae417bb + c43a9f2 commit a493495

File tree

81 files changed

+341
-341
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+341
-341
lines changed

src/sage/algebras/rational_cherednik_algebra.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def algebra_generators(self):
237237
sage: list(R.algebra_generators())
238238
[a1, a2, s1, s2, ac1, ac2]
239239
"""
240-
keys = ['a'+str(i) for i in self._cartan_type.index_set()]
240+
keys = ['a'+str(i) for i in self._cartan_type.index_set()]
241241
keys += ['s'+str(i) for i in self._cartan_type.index_set()]
242242
keys += ['ac'+str(i) for i in self._cartan_type.index_set()]
243243

src/sage/algebras/splitting_algebra.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def __init__(self, monic_polynomial, names='X', iterate=True, warning=True):
217217
deg = monic_polynomial.degree()
218218

219219
from sage.structure.category_object import normalize_names
220-
self._root_names = normalize_names(deg-1, names)
220+
self._root_names = normalize_names(deg-1, names)
221221
root_names = list(self._root_names)
222222
verbose("Create splitting algebra to base ring %s and polynomial %s (%s %s)"
223223
% (base_ring, monic_polynomial, iterate, warning))
@@ -238,8 +238,8 @@ def __init__(self, monic_polynomial, names='X', iterate=True, warning=True):
238238
if deg < 1:
239239
raise ValueError("the degree of the polynomial must positive")
240240

241-
self._splitting_roots = []
242-
self._coefficients_list = []
241+
self._splitting_roots = []
242+
self._coefficients_list = []
243243
self._invertible_elements = {}
244244

245245
if isinstance(base_ring, SplittingAlgebra):
@@ -289,12 +289,12 @@ def __init__(self, monic_polynomial, names='X', iterate=True, warning=True):
289289

290290
SplittingAlgebra.__init__(self, q, root_names_reduces, warning=False)
291291

292-
splitting_roots = base_ring_step._splitting_roots + self._splitting_roots
292+
splitting_roots = base_ring_step._splitting_roots + self._splitting_roots
293293
coefficients_list = base_ring_step._coefficients_list + self._coefficients_list
294294

295295
verbose("Adding roots: %s" % (splitting_roots))
296296

297-
self._splitting_roots = splitting_roots
297+
self._splitting_roots = splitting_roots
298298
self._coefficients_list = coefficients_list
299299
else:
300300
PolynomialQuotientRing_domain.__init__(self, P, p, root_name)
@@ -343,7 +343,7 @@ def __init__(self, monic_polynomial, names='X', iterate=True, warning=True):
343343
# ------------------------------------------------------------------
344344
if cf0_inv is not None:
345345
deg_cf = len(cf)-1
346-
pf = P(cf)
346+
pf = P(cf)
347347
for root in self._splitting_roots:
348348
check = self(pf)
349349
if not check.is_zero():

src/sage/categories/algebra_functor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ def _apply_functor_to_morphism(self, f):
631631
2*() + 2*(2,3) + (1,2,3) + 4*(1,3,2)
632632
"""
633633
from sage.categories.rings import Rings
634-
domain = self(f.domain())
634+
domain = self(f.domain())
635635
codomain = self(f.codomain())
636636
# we would want to use something like:
637637
# domain.module_morphism(on_coefficients=h, codomain=codomain, category=Rings())

src/sage/categories/cartesian_product.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from sage.categories.covariant_functorial_construction import CovariantFunctorialConstruction, CovariantConstructionCategory
1717
from sage.categories.pushout import MultivariateConstructionFunctor
1818

19-
native_python_containers = set([tuple, list, set, frozenset, range])
19+
native_python_containers = set([tuple, list, set, frozenset, range])
2020

2121
class CartesianProductFunctor(CovariantFunctorialConstruction, MultivariateConstructionFunctor):
2222
"""

src/sage/categories/category_with_axiom.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -2609,11 +2609,11 @@ def super_categories(self):
26092609

26102610
class SubcategoryMethods:
26112611
FiniteDimensional = axiom("FiniteDimensional")
2612-
Commutative = axiom("Commutative")
2613-
Unital = axiom("Unital")
2614-
Connected = axiom("Connected")
2615-
Flying = axiom("Flying")
2616-
Blue = axiom("Blue")
2612+
Commutative = axiom("Commutative")
2613+
Unital = axiom("Unital")
2614+
Connected = axiom("Connected")
2615+
Flying = axiom("Flying")
2616+
Blue = axiom("Blue")
26172617

26182618
class FiniteDimensional(CategoryWithAxiom):
26192619
pass

src/sage/categories/covariant_functorial_construction.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def _base_category_class(cls):
286286
"""
287287
module_name = cls.__module__.replace(cls._functor_category.lower() + "_","")
288288
import sys
289-
name = cls.__name__.replace(cls._functor_category, "")
289+
name = cls.__name__.replace(cls._functor_category, "")
290290
__import__(module_name)
291291
module = sys.modules[module_name]
292292
return (module.__dict__[name],)

src/sage/categories/distributive_magmas_and_additive_magmas.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class AdditiveCommutative(CategoryWithAxiom):
4343
class AdditiveUnital(CategoryWithAxiom):
4444
class Associative(CategoryWithAxiom):
4545
AdditiveInverse = LazyImport('sage.categories.rngs', 'Rngs', at_startup=True)
46-
Unital = LazyImport('sage.categories.semirings', 'Semirings', at_startup=True)
46+
Unital = LazyImport('sage.categories.semirings', 'Semirings', at_startup=True)
4747

4848
class ParentMethods:
4949

src/sage/categories/enumerated_sets.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def __iter__(self):
230230
"""
231231
# Check if .first() and .next(x) are overridden in the subclass
232232
if ( self.first != self._first_from_iterator and
233-
self.next != self._next_from_iterator ):
233+
self.next != self._next_from_iterator ):
234234
return self._iterator_from_next()
235235
#Check to see if .unrank() is overridden in the subclass
236236
elif self.unrank != self._unrank_from_iterator:
@@ -592,7 +592,7 @@ def list(self):
592592
[1, 2, 3]
593593
"""
594594
return list(self.tuple())
595-
_list_default = list # needed by the check system.
595+
_list_default = list # needed by the check system.
596596

597597
def _list_from_iterator(self):
598598
r"""
@@ -1108,7 +1108,7 @@ def rank(self):
11081108
"""
11091109
return self.parent().rank(self)
11101110

1111-
Finite = LazyImport('sage.categories.finite_enumerated_sets', 'FiniteEnumeratedSets', at_startup=True)
1111+
Finite = LazyImport('sage.categories.finite_enumerated_sets', 'FiniteEnumeratedSets', at_startup=True)
11121112
Infinite = LazyImport('sage.categories.infinite_enumerated_sets', 'InfiniteEnumeratedSets', at_startup=True)
11131113

11141114
class CartesianProducts(CartesianProductsCategory):

src/sage/categories/infinite_enumerated_sets.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def list(self):
8888
NotImplementedError: cannot list an infinite set
8989
"""
9090
raise NotImplementedError("cannot list an infinite set")
91-
_list_default = list # needed by the check system.
91+
_list_default = list # needed by the check system.
9292

9393
def _test_enumerated_set_iter_cardinality(self, **options):
9494
"""

src/sage/categories/quotient_fields.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def xgcd(self, other):
315315
return (P(g)/P(lcmD), P(s*selfD)/P(lcmD),P(t*otherD)/P(lcmD))
316316
except (AttributeError, NotImplementedError, TypeError, ValueError):
317317
zero = self.parent().zero()
318-
one = self.parent().one()
318+
one = self.parent().one()
319319
if self != zero:
320320
return (one, ~self, zero)
321321
elif other != zero:
@@ -681,11 +681,11 @@ def _derivative(self, var=None):
681681
try:
682682
numder = num._derivative(var)
683683
dender = den._derivative(var)
684-
d = den.gcd(dender)
685-
den = den // d
684+
d = den.gcd(dender)
685+
den = den // d
686686
dender = dender // d
687-
tnum = numder * den - num * dender
688-
tden = self.denominator() * den
687+
tnum = numder * den - num * dender
688+
tden = self.denominator() * den
689689
if not tden.is_one() and tden.is_unit():
690690
try:
691691
tnum = tnum * tden.inverse_of_unit()

src/sage/categories/semigroups.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def cayley_graph(self, side="right", simple=False, elements=None,
327327
generators = self.semigroup_generators()
328328
if isinstance(generators, (list, tuple)):
329329
generators = dict((self(g), self(g)) for g in generators)
330-
left = (side == "left" or side == "twosided")
330+
left = (side == "left" or side == "twosided")
331331
right = (side == "right" or side == "twosided")
332332

333333
def add_edge(source, target, label, side_label):

src/sage/coding/channel.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ def transmit_unsafe(self, message):
603603
zero = V.base_ring().zero()
604604

605605
errors = sample(range(n), number_errors + number_erasures)
606-
error_positions = errors[:number_errors]
606+
error_positions = errors[:number_errors]
607607
erasure_positions = errors[number_errors:]
608608

609609
error_vector = random_error_vector(n, V.base_ring(), error_positions)

src/sage/coding/code_bounds.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ def entropy_inverse(x, q=2):
656656
if q < 2: # Here we check that q is actually at least 2
657657
raise ValueError("The value q must be an integer greater than 1")
658658

659-
eps = 4.5e-16 # find_root has about this as the default xtol
659+
eps = 4.5e-16 # find_root has about this as the default xtol
660660
ymax = 1 - 1/q
661661
if x <= eps:
662662
return 0

src/sage/coding/grs_code.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ def encode(self, p):
10091009
C = self.code()
10101010
if p.degree() >= C.dimension():
10111011
raise ValueError("The polynomial to encode must have degree at most %s" % (C.dimension() - 1))
1012-
alphas = C.evaluation_points()
1012+
alphas = C.evaluation_points()
10131013
col_mults = C.column_multipliers()
10141014
c = vector(C.base_ring(), [col_mults[i]*p(alphas[i]) for i in range(C.length())])
10151015
return c
@@ -1057,7 +1057,7 @@ def unencode_nocheck(self, c):
10571057
10581058
"""
10591059
C = self.code()
1060-
alphas = C.evaluation_points()
1060+
alphas = C.evaluation_points()
10611061
col_mults = C.column_multipliers()
10621062

10631063
c = [c[i]/col_mults[i] for i in range(C.length())]
@@ -1229,14 +1229,14 @@ def _decode_to_code_and_message(self, r):
12291229
r_list = copy(r)
12301230
r_list = [r[i]/col_mults[i] for i in range(0, C.length())]
12311231

1232-
t = (C.minimum_distance()-1) // 2
1232+
t = (C.minimum_distance()-1) // 2
12331233
l0 = n-1-t
12341234
l1 = n-1-t-(k-1)
1235-
S = matrix(C.base_field(), n, l0+l1+2,
1235+
S = matrix(C.base_field(), n, l0+l1+2,
12361236
lambda i, j: (C.evaluation_points()[i])**j if j<(l0+1)
12371237
else r_list[i]*(C.evaluation_points()[i])**(j-(l0+1)))
1238-
S = S.right_kernel()
1239-
S = S.basis_matrix().row(0)
1238+
S = S.right_kernel()
1239+
S = S.basis_matrix().row(0)
12401240
R = C.base_field()['x']
12411241

12421242
Q0 = R(S.list_from_positions(range(l0 + 1)))

src/sage/combinat/cluster_algebra_quiver/mutation_type.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ def _connected_mutation_type(dg):
763763
elif len( exc_labels ) == 1:
764764
label = exc_labels[0]
765765
v_out = label[0]
766-
v_in = label[1]
766+
v_in = label[1]
767767
label = label[2]
768768
if label == (1,-2):
769769
if dict_in_out[ v_in ][0] == 1 and dict_in_out[ v_in ][1] == 0:

src/sage/combinat/crystals/generalized_young_walls.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def e(self, i):
452452
"""
453453
signature = self.generate_signature(i)
454454
raw_signature = signature[0]
455-
lastminus = signature[1].rfind('-')
455+
lastminus = signature[1].rfind('-')
456456
newdata = []
457457
if lastminus > -1:
458458
deletionrow = raw_signature[lastminus][1]
@@ -725,7 +725,7 @@ def in_highest_weight_crystal(self,La):
725725
else:
726726
p_not_found = True
727727
for p in index_set:
728-
if (j+k) % (n+1) == (p+1) % (n+1) and self.a(j,k) - self.a( (j-1) % (n+1) ,k) <= La.scalar(ac[p]):
728+
if (j+k) % (n+1) == (p+1) % (n+1) and self.a(j,k) - self.a( (j-1) % (n+1) ,k) <= La.scalar(ac[p]):
729729
p_not_found = False
730730
continue
731731
else:

src/sage/combinat/designs/bibd.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1372,15 +1372,15 @@ def BIBD_from_arc_in_desarguesian_projective_plane(n,k,existence=False):
13721372
from sage.libs.gap.libgap import libgap
13731373
from sage.matrix.constructor import Matrix
13741374

1375-
K = GF(q,'a')
1375+
K = GF(q,'a')
13761376
one = K.one()
13771377

13781378
# An irreducible quadratic form over K[X,Y]
13791379
GO = libgap.GeneralOrthogonalGroup(-1,2,q)
1380-
M = libgap.InvariantQuadraticForm(GO)['matrix']
1381-
M = Matrix(M)
1382-
M = M.change_ring(K)
1383-
Q = lambda xx,yy : M[0,0]*xx**2+(M[0,1]+M[1,0])*xx*yy+M[1,1]*yy**2
1380+
M = libgap.InvariantQuadraticForm(GO)['matrix']
1381+
M = Matrix(M)
1382+
M = M.change_ring(K)
1383+
Q = lambda xx,yy : M[0,0]*xx**2+(M[0,1]+M[1,0])*xx*yy+M[1,1]*yy**2
13841384

13851385
# Here, the additive subgroup H (of order n) of K mentioned in
13861386
# [Denniston69] is the set of all elements of K of degree < log_n

src/sage/combinat/designs/block_design.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,11 @@ def DesarguesianProjectivePlaneDesign(n, point_coordinates=True, check=True):
343343
# we relabel the points with the integers from 0 to n^2 + n as follows:
344344
# - the affine plane is the set of points [x:y:1] (i.e. the third coordinate
345345
# is non-zero) and gets relabeled from 0 to n^2-1
346-
affine_plane = lambda x,y: relabel[x] + n * relabel[y]
346+
affine_plane = lambda x,y: relabel[x] + n * relabel[y]
347347

348348
# - the affine line is the set of points [x:1:0] (i.e. the third coordinate is
349349
# zero but not the second one) and gets relabeled from n^2 to n^2 + n - 1
350-
line_infinity = lambda x: n2 + relabel[x]
350+
line_infinity = lambda x: n2 + relabel[x]
351351

352352
# - the point is [1:0:0] and gets relabeled n^2 + n
353353
point_infinity = n2 + n
@@ -380,7 +380,7 @@ def DesarguesianProjectivePlaneDesign(n, point_coordinates=True, check=True):
380380

381381
if point_coordinates:
382382
zero = K.zero()
383-
one = K.one()
383+
one = K.one()
384384
d = {affine_plane(x,y): (x,y,one)
385385
for x in Kiter
386386
for y in Kiter}

src/sage/combinat/designs/database.py

+20-20
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ def OA_8_69():
514514
PBD = [[x for x in B if x not in oval] for B in BIBD]
515515

516516
sets_of_size_seven = [R for R in PBD if len(R) == 7]
517-
others = [R for R in PBD if len(R) != 7]
517+
others = [R for R in PBD if len(R) != 7]
518518

519519
# 68, 27, and 52 are the only elements appearing twice in the rows of
520520
# sets_of_size_seven, and each row contains exactly one of them.
@@ -628,7 +628,7 @@ def OA_8_76():
628628
PBD.remove([])
629629

630630
sets_of_size_seven = [R for R in PBD if len(R) == 7]
631-
others = [R for R in PBD if len(R) != 7]
631+
others = [R for R in PBD if len(R) != 7]
632632

633633
# critical_points are the 10 elements appearing twice in the rows of the 10
634634
# sets_of_size_seven, and each row contains exactly two of them
@@ -1477,11 +1477,11 @@ def OA_17_560():
14771477
"""
14781478
from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF
14791479
alpha = 5
1480-
beta = 4
1481-
p = 2
1482-
k = 17
1483-
m = 16
1484-
n = p**alpha
1480+
beta = 4
1481+
p = 2
1482+
k = 17
1483+
m = 16
1484+
n = p**alpha
14851485

14861486
G = GF((p, alpha), prefix='x')
14871487
G_set = sorted(G) # sorted by lexicographic order, G[1] = 1
@@ -3694,7 +3694,7 @@ def DM_52_6_1():
36943694
sage: _ = designs.difference_matrix(52,6)
36953695
"""
36963696
from sage.rings.finite_rings.finite_field_constructor import FiniteField
3697-
F4 = FiniteField(4,'z')
3697+
F4 = FiniteField(4,'z')
36983698
G13 = FiniteField(13)
36993699
G = F4.cartesian_product(G13)
37003700
z = F4('z')
@@ -3805,9 +3805,9 @@ def DM_56_8_1():
38053805
sage: _ = designs.difference_matrix(56,8)
38063806
"""
38073807
from sage.rings.finite_rings.finite_field_constructor import FiniteField
3808-
F8 = FiniteField(8,'z')
3809-
F7 = FiniteField(7)
3810-
G = F8.cartesian_product(F7)
3808+
F8 = FiniteField(8,'z')
3809+
F7 = FiniteField(7)
3810+
G = F8.cartesian_product(F7)
38113811

38123812
w = F8.primitive_element()
38133813
assert w**3 == w+1
@@ -3936,7 +3936,7 @@ def DM_75_8_1():
39363936

39373937
F3 = FiniteField(3)
39383938
F5 = FiniteField(5)
3939-
G = cartesian_product((F3,F5,F5))
3939+
G = cartesian_product((F3,F5,F5))
39403940

39413941
M = [
39423942
[(2,0,0), (0,0,0), (0,0,0), (1,0,0), (0,0,0), (1,0,0), (1,0,0), (0,0,0)],
@@ -4121,7 +4121,7 @@ def RBIBD_120_8_1():
41214121
BIBD = new_BIBD
41224122

41234123
r = {v:i for i,v in enumerate(x for x in range(n) if x not in hyperoval)}
4124-
BIBD = [[r[x] for x in B] for B in BIBD ]
4124+
BIBD = [[r[x] for x in B] for B in BIBD ]
41254125
equiv = [[r[x] for x in B] for B in equiv]
41264126

41274127
BIBD = IncidenceStructure(range(255),BIBD)
@@ -5008,13 +5008,13 @@ def BIBD_56_11_2():
50085008
for k in sorted(EDS))
50095009

50105010
__doc__ = __doc__.format(
5011-
LIST_OF_OA_CONSTRUCTIONS = LIST_OF_OA_CONSTRUCTIONS,
5011+
LIST_OF_OA_CONSTRUCTIONS = LIST_OF_OA_CONSTRUCTIONS,
50125012
LIST_OF_MOLS_CONSTRUCTIONS = LIST_OF_MOLS_CONSTRUCTIONS,
5013-
LIST_OF_VMT_VECTORS = LIST_OF_VMT_VECTORS,
5014-
LIST_OF_BIBD = LIST_OF_BIBD,
5015-
LIST_OF_DF = LIST_OF_DF,
5016-
LIST_OF_DM = LIST_OF_DM,
5017-
LIST_OF_QDM = LIST_OF_QDM,
5018-
LIST_OF_EDS = LIST_OF_EDS)
5013+
LIST_OF_VMT_VECTORS = LIST_OF_VMT_VECTORS,
5014+
LIST_OF_BIBD = LIST_OF_BIBD,
5015+
LIST_OF_DF = LIST_OF_DF,
5016+
LIST_OF_DM = LIST_OF_DM,
5017+
LIST_OF_QDM = LIST_OF_QDM,
5018+
LIST_OF_EDS = LIST_OF_EDS)
50195019
del LIST_OF_OA_CONSTRUCTIONS, LIST_OF_MOLS_CONSTRUCTIONS, LIST_OF_VMT_VECTORS,LIST_OF_DF, LIST_OF_DM, LIST_OF_QDM, LIST_OF_EDS, LIST_OF_BIBD
50205020
del PolynomialRing, ZZ, a,

0 commit comments

Comments
 (0)