Skip to content

Commit 8740ddb

Browse files
committed
fixng some cython-lint suggestions
1 parent 6e64bbf commit 8740ddb

File tree

4 files changed

+15
-19
lines changed

4 files changed

+15
-19
lines changed

cypari2/handle_error.pyx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@ AUTHORS:
1818
# it under the terms of the GNU General Public License as published by
1919
# the Free Software Foundation, either version 2 of the License, or
2020
# (at your option) any later version.
21-
# http://www.gnu.org/licenses/
21+
# https://www.gnu.org/licenses/
2222
#*****************************************************************************
2323

2424
from __future__ import absolute_import, division, print_function
2525

26-
from cpython cimport PyErr_Occurred
27-
2826
from cysignals.signals cimport sig_block, sig_unblock, sig_error
2927

3028
from .paridecl cimport *
@@ -99,7 +97,7 @@ class PariError(RuntimeError):
9997
>>> PariError(11)
10098
PariError(11)
10199
"""
102-
return "PariError(%d)"%self.errnum()
100+
return "PariError(%d)" % self.errnum()
103101

104102
def __str__(self):
105103
r"""

cypari2/pari_instance.pyx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ from .closure cimport _pari_init_closure
296296
# when no explicit precision is given and the inputs are exact.
297297
cdef long prec = prec_bits_to_words(53)
298298

299+
299300
#################################################################
300301
# conversions between various real precision models
301302
#################################################################
@@ -632,10 +633,10 @@ cdef class Pari(Pari_auto):
632633
# chances that something goes wrong here (for example, if we
633634
# are out of memory).
634635
printf("top = %p\navma = %p\nbot = %p\nsize = %lu\n",
635-
<void*>pari_mainstack.top,
636-
<void*>avma,
637-
<void*>pari_mainstack.bot,
638-
<unsigned long>pari_mainstack.rsize)
636+
<void*>pari_mainstack.top,
637+
<void*>avma,
638+
<void*>pari_mainstack.bot,
639+
<unsigned long>pari_mainstack.rsize)
639640
fflush(stdout)
640641

641642
def __repr__(self):
@@ -1025,7 +1026,7 @@ cdef class Pari(Pari_auto):
10251026
set_pari_stack_size(s, sizemax)
10261027
if not silent:
10271028
print("PARI stack size set to {} bytes, maximum size set to {}".
1028-
format(self.stacksize(), self.stacksizemax()))
1029+
format(self.stacksize(), self.stacksizemax()))
10291030

10301031
@staticmethod
10311032
def pari_version():
@@ -1182,7 +1183,7 @@ cdef class Pari(Pari_auto):
11821183
return new_gen(mpfact(n))
11831184

11841185
def polsubcyclo(self, long n, long d, v=None):
1185-
"""
1186+
r"""
11861187
polsubcyclo(n, d, v=x): return the pari list of polynomial(s)
11871188
defining the sub-abelian extensions of degree `d` of the
11881189
cyclotomic field `\QQ(\zeta_n)`, where `d`
@@ -1265,8 +1266,7 @@ cdef class Pari(Pari_auto):
12651266
v = self._empty_vector(n)
12661267
if entries is not None:
12671268
if len(entries) != n:
1268-
raise IndexError("length of entries (=%s) must equal n (=%s)"%\
1269-
(len(entries), n))
1269+
raise IndexError(f"length of entries (={len(entries)}) must equal n (={n})")
12701270
for i, x in enumerate(entries):
12711271
v[i] = x
12721272
return v
@@ -1293,22 +1293,22 @@ cdef class Pari(Pari_auto):
12931293
cdef Gen x
12941294

12951295
sig_on()
1296-
A = new_gen(zeromatcopy(m,n))
1296+
A = new_gen(zeromatcopy(m, n))
12971297
if entries is not None:
12981298
if len(entries) != m * n:
1299-
raise IndexError("len of entries (=%s) must be %s*%s=%s"%(len(entries),m,n,m*n))
1299+
raise IndexError("len of entries (=%s) must be %s*%s=%s" % (len(entries), m, n, m*n))
13001300
k = 0
13011301
for i in range(m):
13021302
for j in range(n):
13031303
sig_check()
13041304
x = objtogen(entries[k])
13051305
set_gcoeff(A.g, i+1, j+1, x.ref_target())
1306-
A.cache((i,j), x)
1306+
A.cache((i, j), x)
13071307
k += 1
13081308
return A
13091309

13101310
def genus2red(self, P, p=None):
1311-
"""
1311+
r"""
13121312
Let `P` be a polynomial with integer coefficients.
13131313
Determines the reduction of the (proper, smooth) genus 2
13141314
curve `C/\QQ`, defined by the hyperelliptic equation `y^2 = P`.

cypari2/paridecl.pxd

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,6 @@ cdef extern from *: # PARI headers already included by types.pxd
10241024
long poliscyclo(GEN f)
10251025
long poliscycloprod(GEN f)
10261026

1027-
10281027
# RgV.c
10291028

10301029
GEN Rg_RgC_sub(GEN a, GEN x)
@@ -3171,7 +3170,6 @@ cdef extern from *: # PARI headers already included by types.pxd
31713170
long z_pval(long n, GEN p)
31723171
long z_pvalrem(long n, GEN p, long *py)
31733172

3174-
31753173
# gen3.c
31763174

31773175
GEN padic_to_Q(GEN x)

cypari2/types.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ cdef extern from "pari/pari.h":
5252
t_INFINITY
5353

5454
int BITS_IN_LONG
55-
long DEFAULTPREC # 64 bits precision
55+
long DEFAULTPREC # 64 bits precision
5656
long MEDDEFAULTPREC # 128 bits precision
5757
long BIGDEFAULTPREC # 192 bits precision
5858

0 commit comments

Comments
 (0)