Skip to content

Commit e90d6be

Browse files
author
Release Manager
committed
gh-35722: cython-lint for imports in libs/ <!-- Please provide a concise, informative and self-explanatory title. --> <!-- Don't put issue numbers in the title. Put it in the Description below. --> <!-- For example, instead of "Fixes #12345", use "Add a new method to multiply two integers" --> ### 📚 Description fix remaining cython-lint warnings about unused imports in `libs` <!-- Describe your changes here in detail. --> <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. It should be `[x]` not `[x ]`. --> - [x] The title is concise, informative, and self-explanatory. - [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 accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #35722 Reported by: Frédéric Chapoton Reviewer(s): Matthias Köppe
2 parents 9c83f60 + b0763e9 commit e90d6be

28 files changed

+53
-92
lines changed

src/sage/libs/eclib/homspace.pyx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,16 @@
33
from cysignals.signals cimport sig_on, sig_off
44
from cython.operator cimport dereference as deref
55
from cython.operator cimport preincrement as inc
6-
from libcpp.map cimport map
76

8-
from ..eclib cimport vec, svec, mat, smat
7+
from ..eclib cimport svec, mat, smat
98
from .mat cimport MatrixFactory
109

1110
from sage.matrix.matrix_space import MatrixSpace
12-
from sage.matrix.matrix_integer_sparse cimport Matrix_integer_sparse
1311
from sage.rings.integer_ring import ZZ
14-
from sage.rings.integer cimport Integer
1512

1613
cdef MatrixFactory MF = MatrixFactory()
1714

15+
1816
cdef class ModularSymbols:
1917
"""
2018
Class of Cremona Modular Symbols of given level and sign (and weight 2).

src/sage/libs/eclib/mwrank.pyx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ EXAMPLES::
1818
sage: t
1919
[[1:2:1]]
2020
"""
21-
2221
import os
23-
import sys
2422

2523
from cysignals.memory cimport sig_free
2624
from cysignals.signals cimport sig_on, sig_off

src/sage/libs/gap/element.pyx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ This document describes the individual wrappers for various GAP
55
elements. For general information about GAP, you should read the
66
:mod:`~sage.libs.gap.libgap` module documentation.
77
"""
8-
98
# ****************************************************************************
109
# Copyright (C) 2012 Volker Braun <[email protected]>
1110
#
@@ -24,8 +23,6 @@ from .libgap import libgap
2423
from .util cimport *
2524
from .util import GAPError
2625
from sage.cpython.string cimport str_to_bytes, char_to_str
27-
from sage.misc.cachefunc import cached_method
28-
from sage.structure.sage_object cimport SageObject
2926
from sage.rings.integer_ring import ZZ
3027
from sage.rings.rational_field import QQ
3128
from sage.rings.real_double import RDF

src/sage/libs/giac/giac.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ import math
151151
# sage includes
152152
from sage.ext.stdsage cimport PY_NEW
153153
154-
from sage.libs.gmp.mpz cimport mpz_t, mpz_init_set
154+
from sage.libs.gmp.mpz cimport mpz_set
155155
156156
from sage.rings.integer_ring import ZZ
157157
from sage.rings.rational_field import QQ

src/sage/libs/lcalc/lcalc_Lfunction.pyx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -949,17 +949,17 @@ def Lfunction_from_character(chi, type="complex"):
949949
OMEGA=1.0/ ( CCC(0,1)**a * (CCC(modulus)).sqrt()/chi.gauss_sum() )
950950

951951
if type == "complex":
952-
dir_coeffs = [CCC(chi(n)) for n in xrange(1, modulus + 1)]
952+
dir_coeffs = [CCC(chi(n)) for n in range(1, modulus + 1)]
953953
return Lfunction_C("", 1,dir_coeffs, period,Q,OMEGA,[.5],[a/2.],poles,residues)
954954
if type not in ["double", "int"]:
955955
raise ValueError("unknown type")
956956
if chi.order() != 2:
957957
raise ValueError("For non quadratic characters you must use type=\"complex\"")
958958
if type == "double":
959-
dir_coeffs = [RRR(chi(n)) for n in xrange(1, modulus + 1)]
959+
dir_coeffs = [RRR(chi(n)) for n in range(1, modulus + 1)]
960960
return Lfunction_D("", 1,dir_coeffs, period,Q,OMEGA,[.5],[a/2.],poles,residues)
961961
if type == "int":
962-
dir_coeffs = [Integer(chi(n)) for n in xrange(1, modulus + 1)]
962+
dir_coeffs = [Integer(chi(n)) for n in range(1, modulus + 1)]
963963
return Lfunction_I("", 1,dir_coeffs, period,Q,OMEGA,[.5],[a/2.],poles,residues)
964964

965965

@@ -990,15 +990,13 @@ def Lfunction_from_elliptic_curve(E, number_of_coeffs=10000):
990990
True
991991
sage: (L.value(0.5, derivative=1) - 0.305999773835200).abs() < 1e-6
992992
True
993-
994993
"""
995-
import sage.libs.lcalc.lcalc_Lfunction
996994
Q = RRR(E.conductor()).sqrt() / RRR(2 * pi)
997995
poles = []
998996
residues = []
999997
dir_coeffs = E.anlist(number_of_coeffs)
1000998
dir_coeffs = [RRR(dir_coeffs[i]) / (RRR(i)).sqrt()
1001-
for i in xrange(1, number_of_coeffs)]
999+
for i in range(1, number_of_coeffs)]
10021000
OMEGA = E.root_number()
10031001
return Lfunction_D("", 2, dir_coeffs, 0, Q, OMEGA, [1], [.5],
10041002
poles, residues)

src/sage/libs/linbox/linbox_flint_interface.pyx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ and C. Pernet. The functions available are:
2121
- ``void linbox_fmpz_mat_det(fmpz_t det, fmpz_mat_t A)``: set ``det`` to the
2222
determinant of the square matrix ``A``
2323
"""
24-
#*****************************************************************************
24+
# ****************************************************************************
2525
# Copyright (C) 2007 Martin Albrecht
2626
# Copyright (C) 2008 Clement Pernet
2727
# Copyright (C) 2017-2018 Vincent Delecroix
@@ -30,15 +30,13 @@ and C. Pernet. The functions available are:
3030
# it under the terms of the GNU General Public License as published by
3131
# the Free Software Foundation, either version 2 of the License, or
3232
# (at your option) any later version.
33-
# http://www.gnu.org/licenses/
34-
#*****************************************************************************
33+
# https://www.gnu.org/licenses/
34+
# ****************************************************************************
3535

36-
from sage.libs.gmp.types cimport mpz_t, mpz_srcptr, mpz_ptr
37-
from sage.libs.gmp.mpz cimport mpz_set
38-
from sage.libs.flint.types cimport fmpz, fmpz_t
36+
from sage.libs.flint.types cimport fmpz_t
3937
from sage.libs.flint.fmpz cimport fmpz_get_mpz, fmpz_set_mpz
4038
from sage.libs.flint.fmpz_mat cimport fmpz_mat_entry, fmpz_mat_nrows, fmpz_mat_ncols
41-
from sage.libs.flint.fmpz_poly cimport fmpz_poly_set_coeff_mpz, fmpz_poly_fit_length, _fmpz_poly_set_length, fmpz_poly_one
39+
from sage.libs.flint.fmpz_poly cimport fmpz_poly_set_coeff_mpz, fmpz_poly_fit_length, _fmpz_poly_set_length
4240

4341
cimport sage.libs.linbox.givaro as givaro
4442
cimport sage.libs.linbox.linbox as linbox

src/sage/libs/mpmath/ext_impl.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1898,7 +1898,7 @@ cdef MPF_complex_pow_re(MPF *zre, MPF *zim, MPF *xre, MPF *xim, MPF *y, MPopts o
18981898
xret = MPF_to_tuple(xre)
18991899
ximt = MPF_to_tuple(xim)
19001900
yret = MPF_to_tuple(y)
1901-
from mpmath.libmp import mpc_pow_mpf, fzero
1901+
from mpmath.libmp import mpc_pow_mpf
19021902
vr, vi = mpc_pow_mpf((xret, ximt), yret,
19031903
opts.prec, rndmode_to_python(opts.rounding))
19041904
MPF_set_tuple(zre, vr)

src/sage/libs/mpmath/ext_main.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ cdef class Context:
480480
100
481481
sage: mp.prec = 53
482482
"""
483-
return libmp.prec_to_dps(global_opts.prec)
483+
return prec_to_dps(global_opts.prec)
484484

485485
dps = property(_get_dps, _set_dps, doc=_get_dps.__doc__)
486486
prec = property(_get_prec, _set_prec, doc=_get_dps.__doc__)

src/sage/libs/ntl/ntl_GF2.pyx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# distutils: extra_link_args = NTL_LIBEXTRA
66
# distutils: language = c++
77

8-
#*****************************************************************************
8+
# ****************************************************************************
99
# Copyright (C) 2007 Martin Albrecht <[email protected]>
1010
#
1111
# Distributed under the terms of the GNU General Public License (GPL)
@@ -17,18 +17,16 @@
1717
#
1818
# The full text of the GPL is available at:
1919
#
20-
# http://www.gnu.org/licenses/
21-
#*****************************************************************************
20+
# https://www.gnu.org/licenses/
21+
# ****************************************************************************
2222

23-
from cysignals.signals cimport sig_on, sig_off
2423
from sage.ext.cplusplus cimport ccrepr, ccreadstr
2524

2625
include 'misc.pxi'
2726
include 'decl.pxi'
2827

2928
from cpython.object cimport Py_EQ, Py_NE
3029
from sage.rings.integer cimport Integer
31-
from sage.rings.integer_ring cimport IntegerRing_class
3230

3331
##############################################################################
3432
# GF2: Bits

src/sage/libs/ntl/ntl_GF2E.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ from .ntl_GF2X cimport ntl_GF2X
3333
from .ntl_GF2EContext cimport ntl_GF2EContext_class
3434
from .ntl_GF2EContext import ntl_GF2EContext
3535
from sage.libs.ntl.ntl_ZZ import unpickle_class_args
36-
from sage.misc.randstate cimport randstate, current_randstate
36+
from sage.misc.randstate cimport current_randstate
3737

3838

3939
##############################################################################

0 commit comments

Comments
 (0)