@@ -27,7 +27,7 @@ Because of this difference in bit lengths, converting integers involves
2727some bit shuffling.
2828"""
2929
30- # * ****************************************************************************
30+ # ****************************************************************************
3131# Copyright (C) 2016 Jeroen Demeyer <[email protected] >3232# Copyright (C) 2016 Luca De Feo <[email protected] >3333# Copyright (C) 2016 Vincent Delecroix <[email protected] >@@ -36,26 +36,25 @@ some bit shuffling.
3636# it under the terms of the GNU General Public License as published by
3737# the Free Software Foundation, either version 2 of the License, or
3838# (at your option) any later version.
39- # http ://www.gnu.org/licenses/
40- # * ****************************************************************************
39+ # https ://www.gnu.org/licenses/
40+ # ****************************************************************************
4141
4242from __future__ import absolute_import, division, print_function
4343
4444from cysignals.signals cimport sig_on, sig_off, sig_error
4545
4646from cpython.version cimport PY_MAJOR_VERSION
47- from cpython.object cimport Py_SIZE
4847from cpython.int cimport PyInt_AS_LONG, PyInt_FromLong
4948from cpython.longintrepr cimport (_PyLong_New,
50- digit, PyLong_SHIFT, PyLong_MASK)
49+ digit, PyLong_SHIFT, PyLong_MASK)
5150from libc.limits cimport LONG_MIN, LONG_MAX
5251from libc.math cimport INFINITY
5352
5453from .paridecl cimport *
5554from .stack cimport new_gen, reset_avma
5655from .string_utils cimport to_string, to_bytes
57- from .pycore_long cimport (ob_digit, _PyLong_IsZero, _PyLong_IsNegative ,
58- _PyLong_IsPositive, _PyLong_DigitCount, _PyLong_SetSignAndDigitCount)
56+ from .pycore_long cimport (ob_digit, _PyLong_IsZero, _PyLong_IsPositive ,
57+ _PyLong_DigitCount, _PyLong_SetSignAndDigitCount)
5958
6059# #######################################################################
6160# Conversion PARI -> Python
@@ -331,8 +330,9 @@ cdef PyObject_FromGEN(GEN g):
331330 lc = lg(g)
332331 if lc <= 1 :
333332 return [[]]
334- lr = lg(gel(g,1 ))
335- return [[PyObject_FromGEN(gcoeff(g, i, j)) for j in range (1 , lc)] for i in range (1 , lr)]
333+ lr = lg(gel(g, 1 ))
334+ return [[PyObject_FromGEN(gcoeff(g, i, j)) for j in range (1 , lc)]
335+ for i in range (1 , lr)]
336336 elif t == t_INFINITY:
337337 if inf_get_sign(g) >= 0 :
338338 return INFINITY
@@ -390,10 +390,10 @@ cdef GEN gtoi(GEN g0) except NULL:
390390 sig_on()
391391 g = simplify_shallow(g0)
392392 if typ(g) == t_COMPLEX:
393- if gequal0(gel(g,2 )):
394- g = gel(g,1 )
393+ if gequal0(gel(g, 2 )):
394+ g = gel(g, 1 )
395395 if typ(g) == t_INTMOD:
396- g = gel(g,2 )
396+ g = gel(g, 2 )
397397 g = trunc_safe(g)
398398 if typ(g) != t_INT:
399399 sig_error()
@@ -614,8 +614,8 @@ def integer_to_gen(x):
614614 if isinstance (x, long ):
615615 sig_on()
616616 return new_gen(PyLong_AS_GEN(x))
617- elif isinstance (x, int ):
617+ if isinstance (x, int ):
618618 sig_on()
619619 return new_gen(stoi(PyInt_AS_LONG(x)))
620- else :
621- raise TypeError ( " integer_to_gen() needs an int or long argument, not {}" .format(type (x).__name__))
620+ raise TypeError ( " integer_to_gen() needs an int or long "
621+ " argument, not {}" .format(type (x).__name__))
0 commit comments