Skip to content

Commit e99b5d9

Browse files
author
Release Manager
committed
gh-35689: cylint: remove unused imports in folders [s-z]* <!-- 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 remove unused imports found by cython-lint in all folders from s* to z* <!-- 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: #35689 Reported by: Frédéric Chapoton Reviewer(s): Travis Scrimshaw
2 parents cd18a67 + f8d3608 commit e99b5d9

File tree

8 files changed

+29
-48
lines changed

8 files changed

+29
-48
lines changed

src/sage/matrix/matrix_space.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
# Sage matrix imports see :trac:`34283`
4040

4141
# Sage imports
42-
import sage.structure.coerce
42+
import sage.structure.coerce_actions
4343
from sage.structure.parent import Parent
4444
from sage.structure.unique_representation import UniqueRepresentation
4545
import sage.rings.integer as integer
@@ -1054,7 +1054,7 @@ def _get_action_(self, S, op, self_on_left):
10541054
return matrix_action.MatrixPolymapAction(self, S)
10551055
else:
10561056
# action of base ring
1057-
return sage.structure.coerce.RightModuleAction(S, self)
1057+
return sage.structure.coerce_actions.RightModuleAction(S, self)
10581058
else:
10591059
if is_MatrixSpace(S):
10601060
# matrix multiplications
@@ -1065,7 +1065,7 @@ def _get_action_(self, S, op, self_on_left):
10651065
return matrix_action.PolymapMatrixAction(self, S)
10661066
else:
10671067
# action of base ring
1068-
return sage.structure.coerce.LeftModuleAction(S, self)
1068+
return sage.structure.coerce_actions.LeftModuleAction(S, self)
10691069
except TypeError:
10701070
return None
10711071

src/sage/stats/time_series.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@ AUTHOR:
3636
- William Stein
3737
"""
3838

39-
#*****************************************************************************
39+
# ****************************************************************************
4040
# Copyright (C) 2008 William Stein <[email protected]>
4141
#
4242
# This program is free software: you can redistribute it and/or modify
4343
# it under the terms of the GNU General Public License as published by
4444
# the Free Software Foundation, either version 2 of the License, or
4545
# (at your option) any later version.
46-
# http://www.gnu.org/licenses/
47-
#*****************************************************************************
46+
# https://www.gnu.org/licenses/
47+
# ****************************************************************************
4848

4949
cimport cython
5050
from cpython.bytes cimport PyBytes_FromStringAndSize, PyBytes_AsString
51-
from libc.math cimport exp, floor, log, pow, sqrt
51+
from libc.math cimport exp, log, pow, sqrt
5252
from libc.string cimport memcpy
5353
from cysignals.memory cimport sig_malloc, sig_free
5454
from sage.structure.richcmp cimport rich_to_bool

src/sage/structure/category_object.pyx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,17 @@ This example illustrates generators for a free module over `\ZZ`.
4747
((1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1))
4848
"""
4949

50-
#*****************************************************************************
50+
# ****************************************************************************
5151
# This program is free software: you can redistribute it and/or modify
5252
# it under the terms of the GNU General Public License as published by
5353
# the Free Software Foundation, either version 2 of the License, or
5454
# (at your option) any later version.
55-
# http://www.gnu.org/licenses/
56-
#*****************************************************************************
55+
# https://www.gnu.org/licenses/
56+
# ****************************************************************************
5757

5858
from sage.cpython.getattr import dir_with_other_class
5959
from sage.cpython.getattr cimport getattr_from_other_class
6060
from sage.categories.category import Category
61-
from sage.structure.debug_options cimport debug
6261
from sage.misc.cachefunc import cached_method
6362
from sage.structure.dynamic_class import DynamicMetaclass
6463

@@ -668,15 +667,16 @@ cdef class CategoryObject(SageObject):
668667
sage: print(latex(f))
669668
5 x_{1}^{10} + x_{0}^{3}
670669
"""
671-
from sage.misc.latex import latex, latex_variable_name
670+
from sage.misc.latex import latex_variable_name
672671
try:
673672
names = self._latex_names
674673
if names is not None:
675674
return names
676675
except AttributeError:
677676
pass
678677
# Compute the latex versions of the variable names.
679-
self._latex_names = [latex_variable_name(x) for x in self.variable_names()]
678+
self._latex_names = [latex_variable_name(x)
679+
for x in self.variable_names()]
680680
return self._latex_names
681681

682682
def latex_name(self):

src/sage/structure/coerce.pyx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,36 +64,35 @@ For more information on how to specify coercions, conversions, and actions,
6464
see the documentation for :class:`Parent`.
6565
"""
6666

67-
#*****************************************************************************
67+
# ****************************************************************************
6868
# Copyright (C) 2007 Robert Bradshaw <[email protected]>
6969
#
7070
# This program is free software: you can redistribute it and/or modify
7171
# it under the terms of the GNU General Public License as published by
7272
# the Free Software Foundation, either version 2 of the License, or
7373
# (at your option) any later version.
74-
# http://www.gnu.org/licenses/
75-
#*****************************************************************************
74+
# https://www.gnu.org/licenses/
75+
# ****************************************************************************
7676

77-
from cpython.object cimport (PyObject, PyTypeObject,
78-
PyObject_CallObject, PyObject_RichCompare, Py_TYPE,
79-
Py_EQ, Py_NE, Py_LT, Py_LE, Py_GT, Py_GE)
77+
from cpython.object cimport (PyTypeObject, PyObject_CallObject,
78+
PyObject_RichCompare, Py_TYPE,
79+
Py_EQ, Py_NE, Py_LT, Py_LE, Py_GT)
8080
from cpython.weakref cimport PyWeakref_GET_OBJECT, PyWeakref_NewRef
8181
from libc.string cimport strncmp
8282
cimport gmpy2
8383

84-
cdef add, mul, truediv
85-
from operator import add, mul, truediv
84+
cdef mul, truediv
85+
from operator import mul, truediv
8686

8787
from .richcmp cimport rich_to_bool, revop
8888
from .sage_object cimport SageObject
8989
from .parent cimport Parent_richcmp_element_without_coercion
9090
from .element cimport bin_op_exception, parent, Element
91-
from .coerce_actions import LeftModuleAction, RightModuleAction
9291
from .coerce_exceptions import CoercionException
9392
from sage.rings.integer_fake cimport is_Integer
9493
from sage.categories.map cimport Map
9594
from sage.categories.morphism import IdentityMorphism
96-
from sage.categories.action cimport Action, InverseAction, PrecomposedAction
95+
from sage.categories.action cimport Action, PrecomposedAction
9796
from sage.sets.pythonclass cimport Set_PythonType
9897

9998
import traceback
@@ -1653,7 +1652,6 @@ cdef class CoercionModel:
16531652
sage: print(cm.discover_coercion(QQ, QQ^3))
16541653
None
16551654
"""
1656-
from sage.categories.homset import Hom
16571655
if R is S:
16581656
return None, None
16591657

src/sage/structure/element.pyx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -290,15 +290,11 @@ continue down the MRO and find the ``_add_`` method in the category.
290290

291291
cimport cython
292292
from cpython cimport *
293-
from cpython.ref cimport PyObject
294293

295294
from sage.ext.stdsage cimport *
296295

297-
import types
298296
cdef add, sub, mul, truediv, floordiv, mod, matmul, pow
299-
cdef iadd, isub, imul, itruediv, ifloordiv, imod, ipow
300-
from operator import (add, sub, mul, truediv, floordiv, mod, matmul, pow,
301-
iadd, isub, imul, itruediv, ifloordiv, imod, imatmul, ipow)
297+
from operator import (add, sub, mul, truediv, floordiv, mod, matmul, pow)
302298

303299
cdef dict _coerce_op_symbols = dict(
304300
add='+', sub='-', mul='*', truediv='/', floordiv='//', mod='%', matmul='@', pow='^',
@@ -310,8 +306,6 @@ from sage.structure.parent cimport Parent
310306
from sage.cpython.type cimport can_assign_class
311307
from sage.cpython.getattr cimport getattr_from_other_class
312308
from sage.misc.lazy_format import LazyFormat
313-
from sage.misc import sageinspect
314-
from sage.misc.classcall_metaclass cimport ClasscallMetaclass
315309
from sage.arith.long cimport integer_check_long_py
316310
from sage.arith.power cimport generic_power as arith_generic_power
317311
from sage.arith.numerical_approx cimport digits_to_bits
@@ -711,7 +705,6 @@ cdef class Element(SageObject):
711705
...
712706
AssertionError: self.an_element() is not in self
713707
"""
714-
from sage.categories.objects import Objects
715708
tester = self._tester(**options)
716709
SageObject._test_category(self, tester = tester)
717710
category = self.category()

src/sage/structure/formal_sum.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
True
5050
"""
5151

52-
#*****************************************************************************
52+
# ****************************************************************************
5353
# Copyright (C) 2004 William Stein <[email protected]>
5454
#
5555
# Distributed under the terms of the GNU General Public License (GPL)
@@ -61,8 +61,8 @@
6161
#
6262
# The full text of the GPL is available at:
6363
#
64-
# http://www.gnu.org/licenses/
65-
#*****************************************************************************
64+
# https://www.gnu.org/licenses/
65+
# ****************************************************************************
6666

6767
from sage.misc.repr import repr_lincomb
6868
import operator
@@ -73,7 +73,7 @@
7373
from sage.structure.richcmp import richcmp
7474
from sage.rings.integer_ring import ZZ
7575
from sage.structure.parent import Parent
76-
from sage.structure.coerce import LeftModuleAction, RightModuleAction
76+
from sage.structure.coerce_actions import LeftModuleAction, RightModuleAction
7777
from sage.categories.action import PrecomposedAction
7878
from sage.structure.unique_representation import UniqueRepresentation
7979

src/sage/structure/parent.pyx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,23 +103,22 @@ This came up in some subtle bug once::
103103
# https://www.gnu.org/licenses/
104104
# ****************************************************************************
105105

106-
from cpython.object cimport PyObject, Py_NE, Py_EQ, Py_LE, Py_GE
106+
from cpython.object cimport Py_EQ, Py_LE, Py_GE
107107
from cpython.bool cimport *
108108

109109
from types import MethodType, BuiltinMethodType
110110
import operator
111111
from copy import copy
112112

113113
from sage.cpython.type cimport can_assign_class
114-
cimport sage.categories.morphism as morphism
115114
cimport sage.categories.map as map
116115
from sage.structure.debug_options cimport debug
117116
from sage.structure.sage_object cimport SageObject
118117
from sage.misc.cachefunc import cached_method
119118
from sage.misc.lazy_attribute import lazy_attribute
120119
from sage.categories.sets_cat import Sets, EmptySetError
121120
from sage.misc.lazy_string cimport _LazyString
122-
from sage.sets.pythonclass cimport Set_PythonType_class, Set_PythonType
121+
from sage.sets.pythonclass cimport Set_PythonType_class
123122
from .category_object import CategoryObject
124123
from .coerce cimport coercion_model
125124
from .coerce cimport parent_is_integers
@@ -2599,7 +2598,6 @@ cdef class Parent(sage.structure.category_object.CategoryObject):
25992598
# If needed, it will be passed to Left/RightModuleAction.
26002599
from sage.categories.action import Action, PrecomposedAction
26012600
from sage.categories.homset import Hom
2602-
from .coerce_actions import LeftModuleAction, RightModuleAction
26032601
cdef Parent R
26042602

26052603
for action in self._action_list:

src/sage/symbolic/ring.pyx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -205,22 +205,14 @@ cdef class SymbolicRing(sage.rings.abc.SymbolicRing):
205205

206206
return False
207207
else:
208-
from sage.rings.real_mpfr import mpfr_prec_min
209-
210208
from sage.rings.fraction_field import is_FractionField
211-
from sage.rings.real_mpfi import is_RealIntervalField
212-
from sage.rings.real_arb import RealBallField
213-
from sage.rings.complex_arb import ComplexBallField
214209
from sage.rings.polynomial.polynomial_ring import is_PolynomialRing
215210
from sage.rings.polynomial.multi_polynomial_ring import is_MPolynomialRing
216211
from sage.rings.polynomial.laurent_polynomial_ring_base import LaurentPolynomialRing_generic
217-
from sage.rings.complex_mpfr import ComplexField
218212
from sage.rings.infinity import InfinityRing, UnsignedInfinityRing
219213
from sage.rings.real_lazy import RLF, CLF
220214
from sage.rings.finite_rings.finite_field_base import FiniteField
221215

222-
from sage.interfaces.maxima import Maxima
223-
224216
from .subring import GenericSymbolicSubring
225217

226218
if R._is_numerical():

0 commit comments

Comments
 (0)