Skip to content

Commit 9d308a5

Browse files
committed
cylint: some details in arith, algebras and crypto folders
1 parent 0fd5967 commit 9d308a5

File tree

9 files changed

+82
-79
lines changed

9 files changed

+82
-79
lines changed

src/sage/algebras/letterplace/free_algebra_letterplace.pyx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ cdef MPolynomialRing_libsingular make_letterplace_ring(base_ring, blocks):
176176
(Lexicographic term order of length 3,
177177
Lexicographic term order of length 3)
178178
"""
179-
n = base_ring.ngens()
180179
T0 = base_ring.term_order()
181180
T = T0
182181
cdef i
@@ -680,7 +679,6 @@ cdef class FreeAlgebra_letterplace(Algebra):
680679
C = self.current_ring()
681680
cdef FreeAlgebraElement_letterplace x
682681
ngens = self.__ngens
683-
degbound = self._degbound
684682
cdef list G = [C(x._poly) for x in g]
685683
from sage.groups.perm_gps.permgroup_named import CyclicPermutationGroup
686684
CG = CyclicPermutationGroup(C.ngens())

src/sage/arith/constants.pxd

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
#
1414

1515
cdef extern from *:
16-
double M_PI "0x3.243f6a8885a3p+0" # π
17-
double M_EULER "0x9.3c467e37db0c8p-4" # γ
18-
double M_LN2 "0xb.17217f7d1cf78p-4" # log(2)
19-
double M_LN10 "0x2.4d763776aaa2cp+0" # log(10)
20-
double M_LNPI "0x1.250d048e7a1bdp+0" # log(π)
21-
double M_1_LN2 "0x1.71547652b82fep+0" # 1/log(2)
22-
double M_1_LN10 "0x6.f2dec549b9438p-4" # 1/log(10)
23-
double M_1_LNPI "0xd.fa22fdd8cfd98p-4" # 1/log(π)
24-
double M_LN2_LN10 "0x4.d104d427de7fcp-4" # log(2)/log(10)
16+
double M_PI "0x3.243f6a8885a3p+0" # π
17+
double M_EULER "0x9.3c467e37db0c8p-4" # γ
18+
double M_LN2 "0xb.17217f7d1cf78p-4" # log(2)
19+
double M_LN10 "0x2.4d763776aaa2cp+0" # log(10)
20+
double M_LNPI "0x1.250d048e7a1bdp+0" # log(π)
21+
double M_1_LN2 "0x1.71547652b82fep+0" # 1/log(2)
22+
double M_1_LN10 "0x6.f2dec549b9438p-4" # 1/log(10)
23+
double M_1_LNPI "0xd.fa22fdd8cfd98p-4" # 1/log(π)
24+
double M_LN2_LN10 "0x4.d104d427de7fcp-4" # log(2)/log(10)
2525

2626
double LOG_TEN_TWO_PLUS_EPSILON "0x3.5269e12f346e4p+0" # log(10,2) rounded up

src/sage/arith/multi_modular.pyx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ cdef class MultiModularBasis_base():
391391
new_partial_products.append(M)
392392
mpz_clear(height)
393393
return self.extend_with_primes(new_moduli, new_partial_products,
394-
check=False)
394+
check=False)
395395

396396
def _extend_moduli_to_count(self, int count):
397397
r"""
@@ -470,7 +470,7 @@ cdef class MultiModularBasis_base():
470470
Compute and store `\prod_j=1^{i-1} m_j^{-1} (mod m_i)` for i >= start.
471471
"""
472472
if start == 0:
473-
start = 1 # first one is trivial, never used
473+
start = 1 # first one is trivial, never used
474474
self.C[0] = 1
475475
for i in range(start, self.n):
476476
self.C[i] = ai.c_inverse_mod_longlong(mpz_fdiv_ui(self.partial_products[i-1], self.moduli[i]), self.moduli[i])
@@ -483,7 +483,7 @@ cdef class MultiModularBasis_base():
483483
self._extend_moduli_to_height_c(height)
484484

485485
cdef int count
486-
count = self.n * mpz_sizeinbase(height, 2) / mpz_sizeinbase(self.partial_products[self.n-1], 2) # an estimate
486+
count = self.n * mpz_sizeinbase(height, 2) / mpz_sizeinbase(self.partial_products[self.n-1], 2) # an estimate
487487
count = max(min(count, self.n), 1)
488488
while count > 1 and mpz_cmp(height, self.partial_products[count-1]) < 0:
489489
count -= 1
@@ -568,7 +568,7 @@ cdef class MultiModularBasis_base():
568568
s = 1
569569
mpz_init_set_si(z, b[0])
570570
if b[0] == 0:
571-
while s < len and b[s] == 0: # fast forward to first non-zero
571+
while s < len and b[s] == 0: # fast forward to first non-zero
572572
s += 1
573573
else:
574574
s = 0
@@ -619,10 +619,10 @@ cdef class MultiModularBasis_base():
619619
if offset == 0:
620620
mpz_set_si(z[j], b[0][j])
621621
if b[0][j] == 0:
622-
while i < len and b[i][j] == 0: # fast forward to first non-zero
622+
while i < len and b[i][j] == 0: # fast forward to first non-zero
623623
i += 1
624624
while i < len:
625-
mpz_set_si(u, ((b[i][j] + m[i] - mpz_fdiv_ui(z[j], m[i])) * self.C[i]) % m[i]) # u = ((b_i - z) * C_i) % m_i
625+
mpz_set_si(u, ((b[i][j] + m[i] - mpz_fdiv_ui(z[j], m[i])) * self.C[i]) % m[i]) # u = ((b_i - z) * C_i) % m_i
626626
mpz_mul(u, u, self.partial_products[i-1])
627627
mpz_add(z[j], z[j], u)
628628
i += 1
@@ -831,7 +831,7 @@ cdef class MultiModularBasis_base():
831831
"""
832832
if isinstance(ix, slice):
833833
return self.__class__(self.list()[ix], l_bound = self._l_bound,
834-
u_bound = self._u_bound)
834+
u_bound = self._u_bound)
835835

836836
cdef Py_ssize_t i = ix
837837
if i != ix:
@@ -850,7 +850,7 @@ cdef class MultiModularBasis_base():
850850
sage: MultiModularBasis_base([10007])
851851
MultiModularBasis with moduli [10007]
852852
"""
853-
return "MultiModularBasis with moduli "+str(self.list())
853+
return "MultiModularBasis with moduli " + str(self.list())
854854

855855

856856
cdef class MultiModularBasis(MultiModularBasis_base):

src/sage/arith/numerical_approx.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ r"""
22
Generic numerical approximation function
33
"""
44

5-
#*****************************************************************************
5+
# ****************************************************************************
66
# Copyright (C) 2016 Jeroen Demeyer <[email protected]>
77
#
88
# This program is free software: you can redistribute it and/or modify
99
# it under the terms of the GNU General Public License as published by
1010
# the Free Software Foundation, either version 2 of the License, or
1111
# (at your option) any later version.
12-
# http://www.gnu.org/licenses/
13-
#*****************************************************************************
12+
# https://www.gnu.org/licenses/
13+
# ****************************************************************************
1414

1515
from sage.structure.parent cimport Parent
1616
from sage.structure.element cimport parent

src/sage/arith/power.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ This implements powering of arbitrary objects using a
55
square-and-multiply algorithm.
66
"""
77

8-
#*****************************************************************************
8+
# ****************************************************************************
99
# Copyright (C) 2017 Jeroen Demeyer <[email protected]>
1010
#
1111
# This program is free software: you can redistribute it and/or modify
1212
# it under the terms of the GNU General Public License as published by
1313
# the Free Software Foundation, either version 2 of the License, or
1414
# (at your option) any later version.
15-
# http://www.gnu.org/licenses/
16-
#*****************************************************************************
15+
# https://www.gnu.org/licenses/
16+
# ****************************************************************************
1717

1818
from cysignals.signals cimport sig_check
1919

src/sage/arith/rational_reconstruction.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ AUTHORS:
1111
- Jeroen Demeyer (2014-10-20): move this function from ``gmp.pxi``,
1212
simplify and fix some bugs, see :trac:`17180`
1313
"""
14-
#*****************************************************************************
14+
# ****************************************************************************
1515
# Copyright (C) 2006 ???
1616
# Copyright (C) 2014 Jeroen Demeyer <[email protected]>
1717
#
1818
# This program is free software: you can redistribute it and/or modify
1919
# it under the terms of the GNU General Public License as published by
2020
# the Free Software Foundation, either version 2 of the License, or
2121
# (at your option) any later version.
22-
# http://www.gnu.org/licenses/
23-
#*****************************************************************************
22+
# https://www.gnu.org/licenses/
23+
# ****************************************************************************
2424

2525
from cysignals.signals cimport sig_on, sig_off
2626

src/sage/crypto/boolean_function.pxd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
cdef inline unsigned int hamming_weight(unsigned int x):
22
# valid for 32bits
3-
x -= (x>>1) & 0x55555555UL # 0-2 in 2 bits
4-
x = ((x>>2) & 0x33333333UL) + (x & 0x33333333UL) # 0-4 in 4 bits
5-
x = ((x>>4) + x) & 0x0f0f0f0fUL # 0-8 in 8 bits
3+
x -= (x>>1) & 0x55555555UL # 0-2 in 2 bits
4+
x = ((x>>2) & 0x33333333UL) + (x & 0x33333333UL) # 0-4 in 4 bits
5+
x = ((x>>4) + x) & 0x0f0f0f0fUL # 0-8 in 8 bits
66
x *= 0x01010101UL
77
return x>>24
88

0 commit comments

Comments
 (0)