Skip to content

Commit 9d8c9c0

Browse files
author
Release Manager
committed
gh-35542: some fixes for cython-lint in various places <!-- 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 This fixes various issues suggested by cython-lint. Mostly about unused imports and variables. <!-- 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: #35542 Reported by: Frédéric Chapoton Reviewer(s): Matthias Köppe
2 parents e1e1194 + b5a69c5 commit 9d8c9c0

20 files changed

+42
-70
lines changed

src/sage/geometry/toric_lattice_element.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ from sage.libs.gmp.mpz cimport *
9999
from sage.geometry.toric_plotter import ToricPlotter
100100
from sage.modules.vector_integer_dense cimport Vector_integer_dense
101101
from sage.structure.coerce_exceptions import CoercionException
102-
from sage.structure.element cimport Element, Vector
102+
from sage.structure.element cimport Vector
103103
from sage.rings.integer cimport Integer
104-
from sage.structure.richcmp cimport richcmp_not_equal, richcmp
104+
from sage.structure.richcmp cimport richcmp_not_equal
105105

106106

107107
def is_ToricLatticeElement(x):

src/sage/geometry/triangulation/base.pyx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ from sage.structure.sage_object cimport SageObject
2626
from sage.structure.parent cimport Parent
2727
from sage.categories.sets_cat import Sets
2828
from sage.matrix.constructor import matrix
29-
from sage.misc.cachefunc import cached_method
3029

3130
from .functions cimport binomial
3231
from .triangulations cimport \
@@ -835,25 +834,23 @@ cdef class PointConfiguration_base(Parent):
835834
simplex = []
836835
cdef int l = 0
837836
cdef int n = self.n_points()
838-
cdef int d = self.dim()+1
837+
cdef int d = self.dim() + 1
839838
cdef int k, b
840-
for k in range(1,d):
839+
for k in range(1, d):
841840
l += 1
842-
i = l
843841
j = 1
844-
b = binomial(n-l,d-k)
845-
while (s>b) and (b>0):
842+
b = binomial(n - l, d - k)
843+
while s > b > 0:
846844
j += 1
847845
l += 1
848846
s -= b
849-
b = binomial(n-l,d-k)
850-
simplex.append(l-1)
851-
simplex.append(s+l-1)
847+
b = binomial(n - l, d - k)
848+
simplex.append(l - 1)
849+
simplex.append(s + l - 1)
852850
assert len(simplex) == d
853851
return tuple(simplex)
854852

855853

856-
857854
########################################################################
858855
cdef class ConnectedTriangulationsIterator(SageObject):
859856
r"""

src/sage/modules/free_module_element.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ cimport cython
114114
from cpython.slice cimport PySlice_GetIndicesEx
115115

116116
from sage.structure.sequence import Sequence
117-
from sage.structure.element cimport Element, ModuleElement, RingElement, Vector
117+
from sage.structure.element cimport Element, RingElement, Vector
118118
from sage.structure.element import canonical_coercion
119119
from sage.structure.richcmp cimport richcmp_not_equal, richcmp, rich_to_bool
120120

src/sage/modules/vector_integer_dense.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,20 @@ TESTS::
4343
True
4444
"""
4545

46-
#*****************************************************************************
46+
# ****************************************************************************
4747
# Copyright (C) 2007 William Stein <[email protected]>
4848
#
4949
# This program is free software: you can redistribute it and/or modify
5050
# it under the terms of the GNU General Public License as published by
5151
# the Free Software Foundation, either version 2 of the License, or
5252
# (at your option) any later version.
53-
# http://www.gnu.org/licenses/
54-
#*****************************************************************************
53+
# https://www.gnu.org/licenses/
54+
# ****************************************************************************
5555

5656
from cysignals.memory cimport check_allocarray, sig_free
5757
from cysignals.signals cimport sig_on, sig_off
5858

59-
from sage.structure.element cimport Element, ModuleElement, RingElement, Vector
59+
from sage.structure.element cimport Element, Vector
6060
from sage.structure.richcmp cimport rich_to_bool
6161
from sage.rings.integer cimport Integer, _Integer_from_mpz
6262

src/sage/modules/vector_mod2_dense.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ TESTS::
4343
from sage.rings.finite_rings.integer_mod cimport IntegerMod_int, IntegerMod_abstract
4444
from sage.rings.integer cimport Integer
4545
from sage.rings.rational cimport Rational
46-
from sage.structure.element cimport Element, ModuleElement, RingElement, Vector
46+
from sage.structure.element cimport Element, Vector
4747
from sage.structure.richcmp cimport rich_to_bool
4848
cimport sage.modules.free_module_element as free_module_element
4949
from .free_module_element import vector

src/sage/modules/vector_modn_dense.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ cdef mod_int ivalue(IntegerMod_abstract x) except -1:
128128
else:
129129
raise TypeError("non-fixed size integer")
130130

131-
from sage.structure.element cimport Element, ModuleElement, RingElement, Vector
131+
from sage.structure.element cimport Element, Vector
132132

133133
cimport sage.modules.free_module_element as free_module_element
134134
from .free_module_element import vector

src/sage/modules/vector_numpy_integer_dense.pyx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ EXAMPLES::
2626
cimport numpy
2727
import numpy
2828

29-
from sage.structure.element cimport Element, Vector
30-
3129
from sage.rings.integer_ring import ZZ
3230

3331
# This is for the NumPy C API (the PyArray... functions) to work

src/sage/numerical/backends/cvxpy_backend.pyx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ AUTHORS:
88
- Matthias Koeppe (2022-03) : this backend
99
1010
"""
11-
1211
# ****************************************************************************
1312
# Copyright (C) 2010 Nathann Cohen <[email protected]>
1413
# Copyright (C) 2022 Matthias Koeppe <[email protected]>
@@ -22,7 +21,6 @@ AUTHORS:
2221

2322
from sage.numerical.mip import MIPSolverException
2423
from sage.rings.real_double import RDF
25-
from sage.modules.free_module_element import vector
2624
from copy import copy
2725
import cvxpy
2826
from cvxpy.atoms.affine.add_expr import AddExpression

src/sage/numerical/backends/glpk_backend.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3129,7 +3129,7 @@ solver_parameter_names_dict = {
31293129
'obj_ll': obj_ll, 'obj_lower_limit': obj_ll,
31303130
'obj_ul': obj_ul, 'obj_upper_limit': obj_ul,
31313131
'it_lim': it_lim, 'iteration_limit': it_lim,
3132-
'out_frq_simplex': out_frq_simplex, 'output_frequency_intopt': out_frq_simplex,
3132+
'out_frq_simplex': out_frq_simplex, 'output_frequency_simplex': out_frq_simplex,
31333133
'out_dly_simplex': out_dly_simplex, 'output_delay_simplex': out_dly_simplex,
31343134
'presolve_simplex': presolve_simplex
31353135
}

src/sage/numerical/backends/scip_backend.pyx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ AUTHORS:
99
- Matthias Koeppe (2017): stubs
1010
- Moritz Firsching (2018-04): rest
1111
"""
12-
1312
# *****************************************************************************
1413
# Copyright (C) 2010 Nathann Cohen <[email protected]>
1514
# 2017-2022 Matthias Koeppe
@@ -19,10 +18,9 @@ AUTHORS:
1918
# it under the terms of the GNU General Public License as published by
2019
# the Free Software Foundation, either version 2 of the License, or
2120
# (at your option) any later version.
22-
# http://www.gnu.org/licenses/
21+
# https://www.gnu.org/licenses/
2322
# *****************************************************************************
2423

25-
from os import sys
2624
from os.path import splitext
2725
from sage.numerical.mip import MIPSolverException
2826
from pyscipopt import Model

0 commit comments

Comments
 (0)