Skip to content

Commit 10c19f1

Browse files
author
Release Manager
committed
gh-40242: cleaning coding/ using cython-lint
clean pyx files in coding folder, following suggestions of cython-lint ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. URL: #40242 Reported by: Frédéric Chapoton Reviewer(s): David Coudert
2 parents 63b5554 + 481d642 commit 10c19f1

File tree

9 files changed

+287
-241
lines changed

9 files changed

+287
-241
lines changed

build/pkgs/configure/checksums.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
tarball=configure-VERSION.tar.gz
2-
sha1=71e76e4d1c6e4c3c6f225a6dbcee0055bca54192
3-
sha256=ba4fb20c79af60e61ca4656cbddb6dfb5d3cee545e751dbb9e49243d345db6db
2+
sha1=33d22817472241d1fe2fff96650d316a2994abc8
3+
sha256=710b5de4286e235fa6a85f512f05a4aef324a94bf06af654ffe3fadeeb8f439e
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5379f2e776e9b8f79a8a2e37f8e407f52e8d26cd
1+
6d8ba06374c4478e7f64a29482e1b6eadc56027b

src/sage/coding/ag_code_decoders.pyx

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -604,15 +604,16 @@ class EvaluationAGCodeUniqueDecoder(Decoder):
604604

605605
if Q.degree() > 1:
606606
circuit = EvaluationAGCodeDecoder_K_extension(code._pls, code._G, Q,
607-
verbose=verbose)
607+
verbose=verbose)
608608
else:
609609
circuit = EvaluationAGCodeDecoder_K(code._pls, code._G, Q,
610-
verbose=verbose)
610+
verbose=verbose)
611611

612612
if basis is None:
613613
basis = code._basis_functions
614614

615-
C = matrix([circuit.decode(vector(K, [f.evaluate(p) for p in code._pls]))
615+
C = matrix([circuit.decode(vector(K,
616+
[f.evaluate(p) for p in code._pls]))
616617
for f in basis])
617618

618619
self._extension = Q.degree() > 1
@@ -647,7 +648,7 @@ class EvaluationAGCodeUniqueDecoder(Decoder):
647648
"""
648649
return hash((self.code(), self._Q))
649650

650-
def __eq__(self, other):
651+
def __eq__(self, other) -> bool:
651652
"""
652653
Check whether ``other`` equals ``self``.
653654

@@ -677,7 +678,7 @@ class EvaluationAGCodeUniqueDecoder(Decoder):
677678
return (self.code() == other.code() and self._Q == other._Q
678679
and self._basis == other._basis)
679680

680-
def _repr_(self):
681+
def _repr_(self) -> str:
681682
r"""
682683
Return the string representation of ``self``.
683684

@@ -699,7 +700,7 @@ class EvaluationAGCodeUniqueDecoder(Decoder):
699700
"""
700701
return "Unique decoder for {}".format(self.code())
701702

702-
def _latex_(self):
703+
def _latex_(self) -> str:
703704
r"""
704705
Return the latex representation of ``self``.
705706

@@ -757,13 +758,13 @@ class EvaluationAGCodeUniqueDecoder(Decoder):
757758
else:
758759
return circuit.encode(vector(K, message) * C)
759760

760-
def _decode(self, vector, **kwargs):
761+
def _decode(self, vect, **kwargs):
761762
r"""
762-
Return the message decoded from ``vector``.
763+
Return the message decoded from the vector ``vect``.
763764
764765
INPUT:
765766
766-
- ``vector`` -- a vector to be decoded to a message
767+
- ``vect`` -- a vector to be decoded to a message
767768
768769
TESTS::
769770
@@ -787,10 +788,10 @@ class EvaluationAGCodeUniqueDecoder(Decoder):
787788
circuit = self._circuit
788789

789790
if self._extension:
790-
internal_message = circuit.decode(circuit._lift(vector), **kwargs) * Cinv
791+
internal_message = circuit.decode(circuit._lift(vect), **kwargs) * Cinv
791792
return circuit._pull_back(internal_message)
792-
else:
793-
return circuit.decode(vector, **kwargs) * Cinv
793+
794+
return circuit.decode(vect, **kwargs) * Cinv
794795

795796
def connected_encoder(self, *args, **kwargs):
796797
r"""
@@ -1011,10 +1012,10 @@ class DifferentialAGCodeUniqueDecoder(Decoder):
10111012

10121013
if Q.degree() > 1:
10131014
circuit = DifferentialAGCodeDecoder_K_extension(code._pls, code._G, Q,
1014-
verbose=verbose)
1015+
verbose=verbose)
10151016
else:
10161017
circuit = DifferentialAGCodeDecoder_K(code._pls, code._G, Q,
1017-
verbose=verbose)
1018+
verbose=verbose)
10181019

10191020
if basis is None:
10201021
basis = code._basis_differentials
@@ -1054,7 +1055,7 @@ class DifferentialAGCodeUniqueDecoder(Decoder):
10541055
"""
10551056
return hash((self.code(), self._Q))
10561057

1057-
def __eq__(self, other):
1058+
def __eq__(self, other) -> bool:
10581059
"""
10591060
Check whether ``other`` equals ``self``.
10601061

@@ -1084,7 +1085,7 @@ class DifferentialAGCodeUniqueDecoder(Decoder):
10841085
return (self.code() == other.code() and self._Q == other._Q
10851086
and self._basis == other._basis)
10861087

1087-
def _repr_(self):
1088+
def _repr_(self) -> str:
10881089
r"""
10891090
Return the string representation of ``self``.
10901091

@@ -1106,7 +1107,7 @@ class DifferentialAGCodeUniqueDecoder(Decoder):
11061107
"""
11071108
return "Unique decoder for {}".format(self.code())
11081109

1109-
def _latex_(self):
1110+
def _latex_(self) -> str:
11101111
r"""
11111112
Return the latex representation of ``self``.
11121113

@@ -1164,13 +1165,13 @@ class DifferentialAGCodeUniqueDecoder(Decoder):
11641165
else:
11651166
return circuit.encode(vector(K, message) * C)
11661167

1167-
def _decode(self, vector, **kwargs):
1168+
def _decode(self, vect, **kwargs):
11681169
r"""
1169-
Return the message decoded from ``vector``.
1170+
Return the message decoded from the vector ``vect``.
11701171
11711172
INPUT:
11721173
1173-
- ``vector`` -- a vector to be decoded to a message
1174+
- ``vect`` -- a vector to be decoded to a message
11741175
11751176
TESTS::
11761177
@@ -1194,10 +1195,10 @@ class DifferentialAGCodeUniqueDecoder(Decoder):
11941195
circuit = self._circuit
11951196

11961197
if self._extension:
1197-
internal_message = circuit.decode(circuit._lift(vector), **kwargs) * Cinv
1198+
internal_message = circuit.decode(circuit._lift(vect), **kwargs) * Cinv
11981199
return circuit._pull_back(internal_message)
1199-
else:
1200-
return circuit.decode(vector, **kwargs) * Cinv
1200+
1201+
return circuit.decode(vect, **kwargs) * Cinv
12011202

12021203
def connected_encoder(self, *args, **kwargs):
12031204
r"""
@@ -1423,7 +1424,7 @@ cdef class Decoder_K():
14231424
This modified the ``vec`` input.
14241425
"""
14251426
cdef Py_ssize_t j, m
1426-
cdef list a, d, s
1427+
cdef list a, s
14271428
cdef FreeModuleElement temp
14281429
cdef Polynomial c
14291430

@@ -1507,7 +1508,6 @@ cdef class Decoder_K():
15071508
coeff_mat = self.coeff_mat
15081509

15091510
cdef list message_index = self.message_index
1510-
cdef list code_basis = self.code_basis
15111511

15121512
cdef int s0 = self.s0
15131513
cdef int tau = self.tau
@@ -1858,7 +1858,7 @@ cdef class EvaluationAGCodeDecoder_K(Decoder_K):
18581858
sage: circuit = EvaluationAGCodeDecoder_K(D, G, Q) # long time
18591859
sage: TestSuite(circuit).run(skip='_test_pickling') # long time
18601860
"""
1861-
cdef int i, j, s, s0, sk, si, n, r, d, num
1861+
cdef int i, j, s, s0, sk, si, n, r, d
18621862
cdef int code_length, genus, gamma, dLO, tau
18631863
cdef list gaps, dR, yR, dRbar, yRbar, evyRbar, nus, mul_mat
18641864
cdef list message_index, code_basis
@@ -2113,7 +2113,7 @@ cdef class DifferentialAGCodeDecoder_K(Decoder_K):
21132113
sage: circuit = DifferentialAGCodeDecoder_K(D, G, Q) # long time
21142114
sage: TestSuite(circuit).run(skip='_test_pickling') # long time
21152115
"""
2116-
cdef int i, j, s, s0, sk, si, n, r, d, num
2116+
cdef int i, j, s, s0, sk, si, n, r, d
21172117
cdef int code_length, genus, gamma, dLO, tau
21182118
cdef list gaps, dR, yR, dWbar, wWbar, reswWbar, nus, mul_mat
21192119
cdef list message_index, code_basis
@@ -2387,7 +2387,7 @@ cdef class Decoder_K_extension():
23872387
# construct constant field extension F_ext of F
23882388
def_poly = F.polynomial().base_extend(F_ext_base)
23892389
F_ext = F_ext_base.extension(def_poly, names=def_poly.variable_name())
2390-
else: # rational function field
2390+
else: # rational function field
23912391
F_ext = F_ext_base
23922392

23932393
O_ext = F_ext.maximal_order()

src/sage/coding/binary_code.pxd

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ cdef class PartitionStack:
6767
cdef int ncols
6868
cdef int radix
6969
cdef int flag
70-
cdef int *col_degs #
71-
cdef int *col_counts #
72-
cdef int *col_output #
73-
cdef int *wd_degs #
74-
cdef int *wd_counts # These are just for scratch space...
75-
cdef int *wd_output #
70+
cdef int *col_degs #
71+
cdef int *col_counts #
72+
cdef int *col_output #
73+
cdef int *wd_degs #
74+
cdef int *wd_counts # These are just for scratch space...
75+
cdef int *wd_output #
7676

7777
cdef int is_discrete(self, int) noexcept
7878
cdef int num_cells(self, int) noexcept

0 commit comments

Comments
 (0)