Skip to content

Commit

Permalink
sagemathgh-38153: Remove imports pyx
Browse files Browse the repository at this point in the history
    
removing a few unused imports in some pyx files

### 📝 Checklist

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
    
URL: sagemath#38153
Reported by: Frédéric Chapoton
Reviewer(s): Matthias Köppe
  • Loading branch information
Release Manager committed Jun 15, 2024
2 parents 4787606 + 4213d3e commit 768f314
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ Methods

from sage.sets.set import Set
from sage.misc.cachefunc import cached_function
from sage.features import PythonModule
from sage.sets.disjoint_set import DisjointSet
from sage.rings.infinity import Infinity
from sage.graphs.distances_all_pairs cimport c_distances_all_pairs
Expand Down
4 changes: 1 addition & 3 deletions src/sage/libs/gmp/pylong.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ AUTHORS:
# 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 Py_SIZE
from cpython.long cimport PyLong_FromLong
from cpython.longintrepr cimport _PyLong_New, py_long, digit, PyLong_SHIFT
from sage.cpython.pycore_long cimport (ob_digit, _PyLong_IsNegative,
Expand Down
1 change: 0 additions & 1 deletion src/sage/libs/ntl/ntl_ZZ_pX.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ include 'decl.pxi'
from cpython.object cimport Py_EQ, Py_NE
from sage.cpython.string cimport char_to_str
from sage.rings.integer cimport Integer
from sage.libs.ntl.convert cimport PyLong_to_ZZ
from sage.libs.ntl.ntl_ZZ cimport ntl_ZZ
from sage.libs.ntl.ntl_ZZ_p cimport ntl_ZZ_p
from sage.libs.ntl.ntl_ZZ_pContext cimport ntl_ZZ_pContext_class
Expand Down
4 changes: 2 additions & 2 deletions src/sage/libs/pari/convert_sage_real_mpfr.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

from cypari2.stack cimport new_gen
from cypari2.paridecl cimport *
from cysignals.signals cimport sig_on, sig_off
from cysignals.signals cimport sig_on

from sage.libs.gmp.mpz cimport *
from sage.libs.mpfr cimport *
from sage.libs.mpfr.types cimport mpfr_t, mpfr_prec_t
from sage.libs.mpfr.types cimport mpfr_prec_t
from sage.rings.real_mpfr cimport RealField_class, RealField


Expand Down
1 change: 0 additions & 1 deletion src/sage/matrix/matrix2.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ from cysignals.signals cimport sig_check

from sage.categories.fields import Fields
from sage.categories.integral_domains import IntegralDomains
from sage.categories.principal_ideal_domains import PrincipalIdealDomains
from sage.categories.rings import Rings
from sage.misc.lazy_string import lazy_string
from sage.misc.randstate cimport current_randstate
Expand Down
20 changes: 11 additions & 9 deletions src/sage/matrix/matrix_laurent_mpolynomial_dense.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ AUTHOR:
# https://www.gnu.org/licenses/
# *****************************************************************************
from sage.matrix.constructor import identity_matrix
from sage.rings.polynomial.laurent_polynomial_ring_base import LaurentPolynomialRing_generic


cdef class Matrix_laurent_mpolynomial_dense(Matrix_generic_dense):
"""
Dense matrix over a Laurent multivariate polynomial ring over a field.
"""
def laurent_matrix_reduction(self):
"""
From a matrix `self` of Laurent polynomials, apply elementary operations
to obtain a matrix `P` of polynomials such that the variables do not divide
no column and no row.
From a matrix ``self`` of Laurent polynomials, apply elementary operations
to obtain a matrix ``P`` of polynomials such that the variables do not divide
any column and any row.
OUTPUT:
Three matrices `L`, `P`, `R` such that ``self` equals `L P R`, where `L` and
`R` are diagonal with monomial entries.
Three matrices ``L``, ``P``, ``R`` such that ``self`` equals ``L P R``,
where ``L`` and ``R`` are diagonal with monomial entries.
EXAMPLES:
Expand All @@ -56,20 +56,22 @@ cdef class Matrix_laurent_mpolynomial_dense(Matrix_generic_dense):
res = self.__copy__()
for j, rw in enumerate(res.rows()):
for t in R.gens():
n = min(mon.degree(t) for a in rw for cf, mon in a)
n = min(mon.degree(t) for a in rw for _, mon in a)
res.rescale_row(j, t ** -n)
mat_l.rescale_col(j, t ** n)
for j, cl in enumerate(res.columns()):
for t in R.gens():
n = min(mon.degree(t) for a in cl for cf, mon in a)
n = min(mon.degree(t) for a in cl for _, mon in a)
res.rescale_col(j, t ** -n)
mat_r.rescale_row(j, t ** n)
res = res.change_ring(R.polynomial_ring())
return mat_l, res, mat_r

def _fitting_ideal(self, i):
r"""
Return the `i`-th Fitting ideal of the matrix. This is the ideal generated
Return the `i`-th Fitting ideal of the matrix.
This is the ideal generated
by the `n - i` minors, where `n` is the number of columns.
INPUT:
Expand Down
6 changes: 2 additions & 4 deletions src/sage/matrix/matrix_mpolynomial_dense.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ from sage.matrix.matrix2 cimport Matrix
from sage.rings.polynomial.multi_polynomial_libsingular cimport MPolynomialRing_libsingular
from sage.rings.polynomial.polynomial_singular_interface import can_convert_to_singular

from sage.libs.singular.function import singular_function, lib

from cysignals.signals cimport sig_on, sig_off
from sage.libs.singular.function import singular_function


cdef class Matrix_mpolynomial_dense(Matrix_generic_dense):
Expand Down Expand Up @@ -518,7 +516,7 @@ cdef class Matrix_mpolynomial_dense(Matrix_generic_dense):

def determinant(self, algorithm=None):
"""
Return the determinant of this matrix
Return the determinant of this matrix.
INPUT:
Expand Down
2 changes: 1 addition & 1 deletion src/sage/matroids/graphic_matroid.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ AUTHORS:
# ****************************************************************************

from sage.matroids.matroid cimport Matroid
from copy import copy, deepcopy
from copy import copy
from sage.matroids.utilities import newlabel, split_vertex, sanitize_contractions_deletions
from itertools import combinations
from sage.rings.integer import Integer
Expand Down
2 changes: 1 addition & 1 deletion src/sage/matroids/linear_matroid.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Methods
# https://www.gnu.org/licenses/
# ****************************************************************************

from copy import copy, deepcopy
from copy import copy
from itertools import product

from cpython.object cimport Py_EQ, Py_NE
Expand Down
2 changes: 1 addition & 1 deletion src/sage/modular/arithgroup/farey_symbol.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ from .congroup_gamma import Gamma_class
from .congroup_sl2z import SL2Z
from sage.modular.cusps import Cusp

from sage.misc.decorators import options, rename_keyword
from sage.misc.decorators import options
from sage.misc.cachefunc import cached_method
from sage.structure.richcmp cimport richcmp_not_equal

Expand Down
1 change: 0 additions & 1 deletion src/sage/plot/plot3d/base.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ AUTHORS:
from cpython.list cimport *

import os
import sys
import zipfile

from functools import reduce
Expand Down
2 changes: 1 addition & 1 deletion src/sage/quadratic_forms/ternary.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Helper code for ternary quadratic forms
# ****************************************************************************

from sage.arith.misc import gcd, inverse_mod, xgcd
from sage.matrix.constructor import matrix, identity_matrix, diagonal_matrix
from sage.matrix.constructor import matrix
from sage.misc.prandom import randint
from sage.rings.finite_rings.integer_mod import mod
from sage.rings.integer_ring import ZZ
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/complex_interval.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ from sage.libs.gmp.mpz cimport mpz_sgn, mpz_cmpabs_ui
from sage.libs.mpfr cimport *
from sage.libs.mpfi cimport *
from sage.libs.flint.fmpz cimport *
from sage.libs.mpfr cimport MPFR_RNDU, MPFR_RNDD
from sage.libs.mpfr cimport MPFR_RNDU
from sage.arith.constants cimport LOG_TEN_TWO_PLUS_EPSILON

from sage.structure.element cimport FieldElement
Expand Down
7 changes: 3 additions & 4 deletions src/sage/rings/polynomial/polynomial_rational_flint.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@ AUTHOR:
- Sebastian Pancratz
"""

#*****************************************************************************
# ****************************************************************************
# Copyright (C) 2010 Sebastian Pancratz <[email protected]>
#
# 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_str, sig_off

from cpython.long cimport PyLong_AsLong
Expand Down
1 change: 0 additions & 1 deletion src/sage/sets/family.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets
from sage.categories.infinite_enumerated_sets import InfiniteEnumeratedSets
from sage.misc.cachefunc import cached_method
from sage.misc.call import AttrCallObject
from sage.misc.lazy_import import LazyImport
from sage.rings.infinity import Infinity
from sage.rings.integer import Integer
from sage.sets.finite_enumerated_set import FiniteEnumeratedSet
Expand Down

0 comments on commit 768f314

Please sign in to comment.