Skip to content

Commit f6b6661

Browse files
author
Release Manager
committed
gh-38666: some care for pep8 E203 in pyx files fixing all E203 warnings in pyx files (except 2 files) ``` E203 whitespace before``` ### 📝 Checklist - [x] The title is concise and informative. - [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 and checked the documentation preview. URL: #38666 Reported by: Frédéric Chapoton Reviewer(s): David Coudert
2 parents 69845c0 + f05a967 commit f6b6661

27 files changed

+221
-222
lines changed

src/sage/algebras/fusion_rings/fast_parallel_fmats_methods.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ cdef list compute_gb(factory, tuple args):
399399
cdef MPolynomialRing_libsingular R = PolynomialRing(factory._FR.field(), len(sorted_vars), 'a', order=term_order)
400400

401401
# Zip tuples into R and compute Groebner basis
402-
cdef idx_map = {old : new for new, old in enumerate(sorted_vars)}
402+
cdef idx_map = {old: new for new, old in enumerate(sorted_vars)}
403403
nvars = len(sorted_vars)
404404
F = factory.field()
405405
cdef list polys = list()

src/sage/coding/codecan/codecan.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -916,8 +916,8 @@ cdef class PartitionRefinementLinearCode(PartitionRefinement_generic):
916916
if self._inner_group.rank < 2:
917917
return True
918918
919-
lower = iter(self._matrix[ : self._inner_group.rank].columns())
920-
upper = iter(self._matrix[self._inner_group.rank : ].columns())
919+
lower = iter(self._matrix[:self._inner_group.rank].columns())
920+
upper = iter(self._matrix[self._inner_group.rank:].columns())
921921
922922
for i in range(self._n):
923923
l = next(lower)

src/sage/combinat/designs/designs_pyx.pyx

+8-8
Original file line numberDiff line numberDiff line change
@@ -289,14 +289,14 @@ def is_orthogonal_array(OA, int k, int n, int t=2, verbose=False, terminology='O
289289
for R in OA:
290290
if len(R) != k:
291291
if verbose:
292-
print({"OA" : "Some row does not have length "+str(k),
293-
"MOLS" : "The number of squares is not "+str(k-2)}[terminology])
292+
print({"OA": "Some row does not have length "+str(k),
293+
"MOLS": "The number of squares is not "+str(k-2)}[terminology])
294294
return False
295295

296296
if len(OA) != n2:
297297
if verbose:
298-
print({"OA" : "The number of rows is {} instead of {}^2={}".format(len(OA),n,n2),
299-
"MOLS" : "All squares do not have dimension n^2={}^2".format(n)}[terminology])
298+
print({"OA": "The number of rows is {} instead of {}^2={}".format(len(OA),n,n2),
299+
"MOLS": "All squares do not have dimension n^2={}^2".format(n)}[terminology])
300300
return False
301301

302302
if n == 0:
@@ -319,8 +319,8 @@ def is_orthogonal_array(OA, int k, int n, int t=2, verbose=False, terminology='O
319319
for j,x in enumerate(R):
320320
if x < 0 or x >= n:
321321
if verbose:
322-
print({"OA" : "{} is not in the interval [0..{}]".format(x,n-1),
323-
"MOLS" : "Entry {} was expected to be in the interval [0..{}]".format(x,n-1)}[terminology])
322+
print({"OA": "{} is not in the interval [0..{}]".format(x,n-1),
323+
"MOLS": "Entry {} was expected to be in the interval [0..{}]".format(x,n-1)}[terminology])
324324
sig_free(OAc)
325325
return False
326326
OAc[j*n2+i] = x
@@ -341,8 +341,8 @@ def is_orthogonal_array(OA, int k, int n, int t=2, verbose=False, terminology='O
341341
sig_free(OAc)
342342
bitset_free(seen)
343343
if verbose:
344-
print({"OA" : "Columns {} and {} are not orthogonal".format(i,j),
345-
"MOLS" : "Squares {} and {} are not orthogonal".format(i,j)}[terminology])
344+
print({"OA": "Columns {} and {} are not orthogonal".format(i,j),
345+
"MOLS": "Squares {} and {} are not orthogonal".format(i,j)}[terminology])
346346
return False
347347

348348
sig_free(OAc)

src/sage/combinat/designs/orthogonal_arrays_find_recursive.pyx

+22-26
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ cpdef find_product_decomposition(int k,int n):
145145
sage: _ = f(*args)
146146
"""
147147
cdef int n1,n2
148-
for n1 in range(2,n):
148+
for n1 in range(2, n):
149149
n2 = n/n1 # n2 is decreasing along the loop
150150
if n2 < n1:
151151
break
@@ -194,15 +194,13 @@ cpdef find_wilson_decomposition_with_one_truncated_group(int k,int n):
194194
if u == 0 or (u>1 and k >= u+2):
195195
continue
196196

197-
m = n/r
197+
m = n // r
198198
# If there exists a TD(k,m) then k<m+2
199199
if k >= m+2:
200200
break
201201

202-
if (is_available(k ,m ) and
203-
is_available(k ,m+1) and
204-
is_available(k+1,r ) and
205-
is_available(k ,u )):
202+
if (is_available(k, m) and is_available(k, m + 1) and
203+
is_available(k + 1, r) and is_available(k, u)):
206204
from sage.combinat.designs.orthogonal_arrays import wilson_construction
207205
return wilson_construction, (None,k,r,m,(u,),False)
208206

@@ -294,22 +292,20 @@ cpdef find_construction_3_3(int k,int n):
294292
sage: find_construction_3_3(12,11)
295293
"""
296294
cdef int mm,nn,i
297-
for mm in range(k-1,n/2+1):
298-
if (not is_available(k ,mm ) or
299-
not is_available(k ,mm+1)):
295+
for mm in range(k-1, n//2+1):
296+
if not(is_available(k, mm) and is_available(k, mm + 1)):
300297
continue
301298

302-
for nn in range(2,n/mm+1):
299+
for nn in range(2, n//mm+1):
303300
i = n-nn*mm
304-
if i<=0:
301+
if i <= 0:
305302
continue
306303

307-
if (is_available(k+i, nn ) and
308-
is_available(k , mm+i)):
304+
if is_available(k + i, nn) and is_available(k, mm + i):
309305
from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_3_3
310-
return construction_3_3, (k,nn,mm,i)
306+
return construction_3_3, (k, nn, mm, i)
311307

312-
cpdef find_construction_3_4(int k,int n):
308+
cpdef find_construction_3_4(int k, int n):
313309
r"""
314310
Find a decomposition for construction 3.4 from [AC07]_.
315311
@@ -339,20 +335,20 @@ cpdef find_construction_3_4(int k,int n):
339335
not is_available(k,mm+2)):
340336
continue
341337

342-
for nn in range(2,n/mm+1):
338+
for nn in range(2, n//mm+1):
343339
i = n-nn*mm
344340
if i<=0:
345341
continue
346342

347343
for s in range(1,min(i,nn)):
348344
r = i-s
349-
if (is_available(k+r+1,nn) and
350-
is_available(k , s) and
351-
(is_available(k,mm+r) or is_available(k,mm+r+1))):
345+
if (is_available(k + r + 1, nn) and
346+
is_available(k, s) and
347+
(is_available(k, mm + r) or is_available(k, mm + r + 1))):
352348
from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_3_4
353-
return construction_3_4, (k,nn,mm,r,s)
349+
return construction_3_4, (k, nn, mm, r, s)
354350

355-
cpdef find_construction_3_5(int k,int n):
351+
cpdef find_construction_3_5(int k, int n):
356352
r"""
357353
Find a decomposition for construction 3.5 from [AC07]_.
358354
@@ -376,14 +372,14 @@ cpdef find_construction_3_5(int k,int n):
376372
sage: find_construction_3_5(9,24)
377373
"""
378374
cdef int mm,i,nn,r,s,t
379-
for mm in range(2,n/2+1):
375+
for mm in range(2, n//2+1):
380376
if (mm+3 >= n or
381377
not is_available(k,mm+1) or
382378
not is_available(k,mm+2) or
383379
not is_available(k,mm+3)):
384380
continue
385381

386-
for nn in range(2,n/mm+1):
382+
for nn in range(2, n//mm+1):
387383
i = n-nn*mm
388384
if i<=0:
389385
continue
@@ -433,7 +429,7 @@ cpdef find_construction_3_6(int k,int n):
433429
not is_available(k,mm+2)):
434430
continue
435431

436-
for nn in range(2,n/mm+1):
432+
for nn in range(2, n//mm+1):
437433
i = n-nn*mm
438434
if i<=0:
439435
continue
@@ -913,7 +909,7 @@ cpdef find_brouwer_van_rees_with_one_truncated_column(int k,int n):
913909
cdef tuple values
914910

915911
# We write n=rm+remainder
916-
for m in range(2,n//2):
912+
for m in range(2, n//2):
917913
if not is_available(k,m):
918914
continue
919915

@@ -935,7 +931,7 @@ cpdef find_brouwer_van_rees_with_one_truncated_column(int k,int n):
935931
continue
936932

937933
max_multiplier = max(available_multipliers)
938-
for r in range(2,n//m+1):
934+
for r in range(2, n//m+1):
939935
remainder = n-r*m
940936
if (remainder > r*max_multiplier or
941937
not is_available(k+1,r) or

src/sage/libs/flint/fmpz_poly_sage.pyx

+5-5
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ cdef class Fmpz_poly(SageObject):
8787
sage: f[2] == 10**100000
8888
True
8989
"""
90-
if isinstance(value, Integer) :
90+
if isinstance(value, Integer):
9191
fmpz_poly_set_coeff_mpz(self.poly, i, (<Integer>value).value)
92-
else :
92+
else:
9393
fmpz_poly_set_coeff_si(self.poly, i, value)
9494

9595
def __getitem__(self, i):
@@ -336,7 +336,7 @@ cdef class Fmpz_poly(SageObject):
336336
fmpz_poly_divrem(Q.poly, R.poly, self.poly, other.poly)
337337
return Q, R
338338

339-
def left_shift(self, unsigned long n) :
339+
def left_shift(self, unsigned long n):
340340
"""
341341
Left shift ``self`` by `n`.
342342
@@ -353,7 +353,7 @@ cdef class Fmpz_poly(SageObject):
353353

354354
return res
355355

356-
def right_shift(self, unsigned long n) :
356+
def right_shift(self, unsigned long n):
357357
"""
358358
Right shift ``self`` by `n`.
359359
@@ -383,7 +383,7 @@ cdef class Fmpz_poly(SageObject):
383383
fmpz_poly_pseudo_divrem(Q.poly, R.poly, &d, self.poly, other.poly)
384384
return Q, R, d
385385

386-
def derivative(self) :
386+
def derivative(self):
387387
"""
388388
Return the derivative of ``self``.
389389

0 commit comments

Comments
 (0)