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

cython-linting of unused imports in modules and dynamics #35623

Merged
merged 2 commits into from
May 28, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ AUTHORS:

"""

#*****************************************************************************
# ****************************************************************************
# Copyright (C) 2014 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/
# ****************************************************************************

from sage.arith.functions cimport LCM_list
from sage.rings.finite_rings.finite_field_constructor import GF
from sage.sets.set import Set
from sage.misc.misc import subsets


cpdef _fast_possible_periods(self, return_points=False):
r"""
Return the list of possible minimal periods of a periodic point
Expand Down
10 changes: 4 additions & 6 deletions src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,22 @@ AUTHORS:
- Ben Barros

"""

#*****************************************************************************
# ****************************************************************************
# Copyright (C) 2017 BEN BARROS <bbarros@slu.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 sage.plot.colors import Color
from sage.repl.image import Image
from copy import copy
from cysignals.signals cimport sig_check
from sage.rings.complex_mpfr import ComplexField
from sage.functions.log import exp, log
from sage.symbolic.constants import pi
from sage.functions.log import exp
from sage.symbolic.relation import solve
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.cc import CC
Expand Down
1 change: 0 additions & 1 deletion src/sage/modules/free_module_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ from sage.rings.infinity import Infinity, AnInfinity
from sage.rings.integer_ring import ZZ
from sage.rings.abc import RealDoubleField, ComplexDoubleField

from sage.rings.ring cimport Ring
from sage.rings.integer cimport Integer, smallInteger
from sage.arith.numerical_approx cimport digits_to_bits

Expand Down
2 changes: 0 additions & 2 deletions src/sage/modules/vector_integer_dense.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ from sage.rings.integer cimport Integer, _Integer_from_mpz

cimport sage.modules.free_module_element as free_module_element

from .free_module_element import vector

from sage.libs.gmp.mpz cimport *

cdef class Vector_integer_dense(free_module_element.FreeModuleElement):
Expand Down
1 change: 0 additions & 1 deletion src/sage/modules/vector_mod2_dense.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ from sage.rings.rational cimport Rational
from sage.structure.element cimport Element, Vector
from sage.structure.richcmp cimport rich_to_bool
cimport sage.modules.free_module_element as free_module_element
from .free_module_element import vector

from sage.libs.m4ri cimport *

Expand Down
2 changes: 1 addition & 1 deletion src/sage/modules/vector_modn_dense.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ cdef mod_int ivalue(IntegerMod_abstract x) except -1:
from sage.structure.element cimport Element, Vector

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


cdef class Vector_modn_dense(free_module_element.FreeModuleElement):
cdef _new_c(self):
Expand Down
27 changes: 13 additions & 14 deletions src/sage/modules/vector_rational_dense.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,25 @@ TESTS::
True
"""

#*****************************************************************************
# ****************************************************************************
# Copyright (C) 2007 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/
# ****************************************************************************

from cysignals.memory cimport check_allocarray, sig_free
from cysignals.signals cimport sig_on, sig_off

from sage.structure.element cimport Element, ModuleElement, RingElement, Vector
from sage.structure.element cimport Element, Vector
from sage.structure.richcmp cimport rich_to_bool
from sage.rings.integer cimport Integer
from sage.rings.rational cimport Rational

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

from sage.libs.gmp.mpq cimport *

Expand Down Expand Up @@ -146,7 +145,7 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement):
cdef Rational z
if isinstance(x, (list, tuple)):
if len(x) != self._degree:
raise TypeError("entries must be a list of length %s"%self._degree)
raise TypeError("entries must be a list of length %s" % self._degree)
for i from 0 <= i < self._degree:
z = Rational(x[i])
mpq_set(self._entries[i], z.value)
Expand Down Expand Up @@ -229,8 +228,7 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement):
"""
mpq_set(self._entries[i], (<Rational>value).value)


def list(self,copy=True):
def list(self, copy=True):
"""
The list of entries of the vector.

Expand All @@ -248,8 +246,8 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement):
(1, 2, 3, 4)
"""
cdef int i
return [_Rational_from_mpq(self._entries[i]) for i in
xrange(self._degree)]
return [_Rational_from_mpq(self._entries[i])
for i in range(self._degree)]

def __reduce__(self):
return (unpickle_v1, (self._parent, self.list(), self._degree,
Expand All @@ -264,7 +262,6 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement):
mpq_add(z._entries[i], self._entries[i], r._entries[i])
return z


cpdef _sub_(self, right):
cdef Vector_rational_dense z, r
r = right
Expand Down Expand Up @@ -299,7 +296,6 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement):
mpq_clear(t)
return z


cpdef _pairwise_product_(self, Vector right):
"""
EXAMPLES::
Expand All @@ -326,7 +322,8 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement):
mpq_set_z(a.value, (<Integer>left).value)
else:
# should not happen
raise TypeError("cannot convert %s to %s" % (type(left).__name__, Rational.__name__))
raise TypeError("cannot convert %s to %s" % (type(left).__name__,
Rational.__name__))
z = self._new_c()
cdef Py_ssize_t i
for i in range(self._degree):
Expand All @@ -343,7 +340,8 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement):
mpq_set_z(a.value, (<Integer>right).value)
else:
# should not happen
raise TypeError("cannot convert %s to %s" % (type(right).__name__, Rational.__name__))
raise TypeError("cannot convert %s to %s" % (type(right).__name__,
Rational.__name__))
z = self._new_c()
cdef Py_ssize_t i
for i in range(self._degree):
Expand Down Expand Up @@ -374,6 +372,7 @@ def unpickle_v0(parent, entries, degree):
mpq_set(v._entries[i], z.value)
return v


def unpickle_v1(parent, entries, degree, is_mutable):
cdef Vector_rational_dense v
v = Vector_rational_dense.__new__(Vector_rational_dense)
Expand Down
5 changes: 0 additions & 5 deletions src/sage/modules/with_basis/indexed_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,9 @@ from sage.structure.richcmp cimport richcmp, rich_to_bool
from cpython.object cimport Py_NE, Py_EQ

from sage.misc.repr import repr_lincomb
from sage.misc.cachefunc import cached_method
from sage.misc.lazy_attribute import lazy_attribute
from sage.misc.superseded import deprecation
from sage.typeset.ascii_art import AsciiArt, empty_ascii_art, ascii_art
from sage.typeset.unicode_art import UnicodeArt, empty_unicode_art, unicode_art
from sage.categories.category import Category
from sage.categories.sets_cat import Sets
from sage.categories.modules_with_basis import ModulesWithBasis
from sage.data_structures.blas_dict cimport add, negate, scal, axpy


Expand Down