Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cylint: remove unused imports in folders [s-z]* #35689

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/sage/matrix/matrix_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
# Sage matrix imports see :trac:`34283`

# Sage imports
import sage.structure.coerce
import sage.structure.coerce_actions
from sage.structure.parent import Parent
from sage.structure.unique_representation import UniqueRepresentation
import sage.rings.integer as integer
Expand Down Expand Up @@ -1054,7 +1054,7 @@ def _get_action_(self, S, op, self_on_left):
return matrix_action.MatrixPolymapAction(self, S)
else:
# action of base ring
return sage.structure.coerce.RightModuleAction(S, self)
return sage.structure.coerce_actions.RightModuleAction(S, self)
else:
if is_MatrixSpace(S):
# matrix multiplications
Expand All @@ -1065,7 +1065,7 @@ def _get_action_(self, S, op, self_on_left):
return matrix_action.PolymapMatrixAction(self, S)
else:
# action of base ring
return sage.structure.coerce.LeftModuleAction(S, self)
return sage.structure.coerce_actions.LeftModuleAction(S, self)
except TypeError:
return None

Expand Down
8 changes: 4 additions & 4 deletions src/sage/stats/time_series.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ AUTHOR:
- William Stein
"""

#*****************************************************************************
# ****************************************************************************
# Copyright (C) 2008 William Stein <wstein@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************
# https://www.gnu.org/licenses/
# ****************************************************************************

cimport cython
from cpython.bytes cimport PyBytes_FromStringAndSize, PyBytes_AsString
from libc.math cimport exp, floor, log, pow, sqrt
from libc.math cimport exp, log, pow, sqrt
from libc.string cimport memcpy
from cysignals.memory cimport sig_malloc, sig_free
from sage.structure.richcmp cimport rich_to_bool
Expand Down
12 changes: 6 additions & 6 deletions src/sage/structure/category_object.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,17 @@ This example illustrates generators for a free module over `\ZZ`.
((1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1))
"""

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

from sage.cpython.getattr import dir_with_other_class
from sage.cpython.getattr cimport getattr_from_other_class
from sage.categories.category import Category
from sage.structure.debug_options cimport debug
from sage.misc.cachefunc import cached_method
from sage.structure.dynamic_class import DynamicMetaclass

Expand Down Expand Up @@ -668,15 +667,16 @@ cdef class CategoryObject(SageObject):
sage: print(latex(f))
5 x_{1}^{10} + x_{0}^{3}
"""
from sage.misc.latex import latex, latex_variable_name
from sage.misc.latex import latex_variable_name
try:
names = self._latex_names
if names is not None:
return names
except AttributeError:
pass
# Compute the latex versions of the variable names.
self._latex_names = [latex_variable_name(x) for x in self.variable_names()]
self._latex_names = [latex_variable_name(x)
for x in self.variable_names()]
return self._latex_names

def latex_name(self):
Expand Down
20 changes: 9 additions & 11 deletions src/sage/structure/coerce.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -64,36 +64,35 @@ For more information on how to specify coercions, conversions, and actions,
see the documentation for :class:`Parent`.
"""

#*****************************************************************************
# ****************************************************************************
# Copyright (C) 2007 Robert Bradshaw <robertwb@math.washington.edu>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************
# https://www.gnu.org/licenses/
# ****************************************************************************

from cpython.object cimport (PyObject, PyTypeObject,
PyObject_CallObject, PyObject_RichCompare, Py_TYPE,
Py_EQ, Py_NE, Py_LT, Py_LE, Py_GT, Py_GE)
from cpython.object cimport (PyTypeObject, PyObject_CallObject,
PyObject_RichCompare, Py_TYPE,
Py_EQ, Py_NE, Py_LT, Py_LE, Py_GT)
from cpython.weakref cimport PyWeakref_GET_OBJECT, PyWeakref_NewRef
from libc.string cimport strncmp
cimport gmpy2

cdef add, mul, truediv
from operator import add, mul, truediv
cdef mul, truediv
from operator import mul, truediv

from .richcmp cimport rich_to_bool, revop
from .sage_object cimport SageObject
from .parent cimport Parent_richcmp_element_without_coercion
from .element cimport bin_op_exception, parent, Element
from .coerce_actions import LeftModuleAction, RightModuleAction
from .coerce_exceptions import CoercionException
from sage.rings.integer_fake cimport is_Integer
from sage.categories.map cimport Map
from sage.categories.morphism import IdentityMorphism
from sage.categories.action cimport Action, InverseAction, PrecomposedAction
from sage.categories.action cimport Action, PrecomposedAction
from sage.sets.pythonclass cimport Set_PythonType

import traceback
Expand Down Expand Up @@ -1652,7 +1651,6 @@ cdef class CoercionModel:
sage: print(cm.discover_coercion(QQ, QQ^3))
None
"""
from sage.categories.homset import Hom
if R is S:
return None, None

Expand Down
9 changes: 1 addition & 8 deletions src/sage/structure/element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,11 @@ continue down the MRO and find the ``_add_`` method in the category.

cimport cython
from cpython cimport *
from cpython.ref cimport PyObject

from sage.ext.stdsage cimport *

import types
cdef add, sub, mul, truediv, floordiv, mod, matmul, pow
cdef iadd, isub, imul, itruediv, ifloordiv, imod, ipow
from operator import (add, sub, mul, truediv, floordiv, mod, matmul, pow,
iadd, isub, imul, itruediv, ifloordiv, imod, imatmul, ipow)
from operator import (add, sub, mul, truediv, floordiv, mod, matmul, pow)

cdef dict _coerce_op_symbols = dict(
add='+', sub='-', mul='*', truediv='/', floordiv='//', mod='%', matmul='@', pow='^',
Expand All @@ -310,8 +306,6 @@ from sage.structure.parent cimport Parent
from sage.cpython.type cimport can_assign_class
from sage.cpython.getattr cimport getattr_from_other_class
from sage.misc.lazy_format import LazyFormat
from sage.misc import sageinspect
from sage.misc.classcall_metaclass cimport ClasscallMetaclass
from sage.arith.long cimport integer_check_long_py
from sage.arith.power cimport generic_power as arith_generic_power
from sage.arith.numerical_approx cimport digits_to_bits
Expand Down Expand Up @@ -711,7 +705,6 @@ cdef class Element(SageObject):
...
AssertionError: self.an_element() is not in self
"""
from sage.categories.objects import Objects
tester = self._tester(**options)
SageObject._test_category(self, tester = tester)
category = self.category()
Expand Down
8 changes: 4 additions & 4 deletions src/sage/structure/formal_sum.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
True
"""

#*****************************************************************************
# ****************************************************************************
# Copyright (C) 2004 William Stein <wstein@gmail.com>
#
# Distributed under the terms of the GNU General Public License (GPL)
Expand All @@ -61,8 +61,8 @@
#
# The full text of the GPL is available at:
#
# http://www.gnu.org/licenses/
#*****************************************************************************
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.misc.repr import repr_lincomb
import operator
Expand All @@ -73,7 +73,7 @@
from sage.structure.richcmp import richcmp
from sage.rings.integer_ring import ZZ
from sage.structure.parent import Parent
from sage.structure.coerce import LeftModuleAction, RightModuleAction
from sage.structure.coerce_actions import LeftModuleAction, RightModuleAction
from sage.categories.action import PrecomposedAction
from sage.structure.unique_representation import UniqueRepresentation

Expand Down
6 changes: 2 additions & 4 deletions src/sage/structure/parent.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -103,23 +103,22 @@ This came up in some subtle bug once::
# https://www.gnu.org/licenses/
# ****************************************************************************

from cpython.object cimport PyObject, Py_NE, Py_EQ, Py_LE, Py_GE
from cpython.object cimport Py_EQ, Py_LE, Py_GE
from cpython.bool cimport *

from types import MethodType, BuiltinMethodType
import operator
from copy import copy

from sage.cpython.type cimport can_assign_class
cimport sage.categories.morphism as morphism
cimport sage.categories.map as map
from sage.structure.debug_options cimport debug
from sage.structure.sage_object cimport SageObject
from sage.misc.cachefunc import cached_method
from sage.misc.lazy_attribute import lazy_attribute
from sage.categories.sets_cat import Sets, EmptySetError
from sage.misc.lazy_string cimport _LazyString
from sage.sets.pythonclass cimport Set_PythonType_class, Set_PythonType
from sage.sets.pythonclass cimport Set_PythonType_class
from .category_object import CategoryObject
from .coerce cimport coercion_model
from .coerce cimport parent_is_integers
Expand Down Expand Up @@ -2597,7 +2596,6 @@ cdef class Parent(sage.structure.category_object.CategoryObject):
# If needed, it will be passed to Left/RightModuleAction.
from sage.categories.action import Action, PrecomposedAction
from sage.categories.homset import Hom
from .coerce_actions import LeftModuleAction, RightModuleAction
cdef Parent R

for action in self._action_list:
Expand Down
8 changes: 0 additions & 8 deletions src/sage/symbolic/ring.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -205,22 +205,14 @@ cdef class SymbolicRing(sage.rings.abc.SymbolicRing):

return False
else:
from sage.rings.real_mpfr import mpfr_prec_min

from sage.rings.fraction_field import is_FractionField
from sage.rings.real_mpfi import is_RealIntervalField
from sage.rings.real_arb import RealBallField
from sage.rings.complex_arb import ComplexBallField
from sage.rings.polynomial.polynomial_ring import is_PolynomialRing
from sage.rings.polynomial.multi_polynomial_ring import is_MPolynomialRing
from sage.rings.polynomial.laurent_polynomial_ring_base import LaurentPolynomialRing_generic
from sage.rings.complex_mpfr import ComplexField
from sage.rings.infinity import InfinityRing, UnsignedInfinityRing
from sage.rings.real_lazy import RLF, CLF
from sage.rings.finite_rings.finite_field_base import FiniteField

from sage.interfaces.maxima import Maxima

from .subring import GenericSymbolicSubring

if R._is_numerical():
Expand Down