Skip to content

Commit f1913ab

Browse files
committed
remove unused variables in rings/
1 parent 665a3fa commit f1913ab

10 files changed

+19
-41
lines changed

src/sage/rings/bernoulli_mod_p.pyx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ def bernoulli_mod_p(int p):
145145
g = primitive_root(p)
146146
gInv = arith_int.c_inverse_mod_int(g, p)
147147
gSqr = ((<llong> g) * g) % p
148-
gInvSqr = ((<llong> gInv) * gInv) % p
149148
isOdd = ((p-1)/2) % 2
150149

151150
# STEP 1: compute the polynomials G(X) and J(X)

src/sage/rings/complex_interval.pyx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,6 @@ cdef class ComplexIntervalFieldElement(FieldElement):
11651165
11661166
- [RL1971]_
11671167
"""
1168-
cdef ComplexIntervalFieldElement result
11691168
x = self._new()
11701169

11711170
if mpfi_nan_p(self.__re) or mpfi_nan_p(self.__im):

src/sage/rings/function_field/khuri_makdisi.pyx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,9 @@ cdef class KhuriMakdisi_base(object):
153153
"""
154154
cdef Matrix mat, perp, vmu
155155
cdef FreeModuleElement v
156-
cdef Py_ssize_t nd, ne, nde, r
156+
cdef Py_ssize_t ne, r
157157

158158
ne = we.ncols()
159-
nde = wde.ncols()
160-
nd = nde - ne
161159

162160
perp = wde.right_kernel_matrix()
163161
mat = matrix(0, mu_mat.nrows())

src/sage/rings/polynomial/multi_polynomial.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2948,7 +2948,7 @@ cdef class MPolynomial(CommutativePolynomial):
29482948
(2*x^2 - 3*x - 5*y, -1)
29492949
"""
29502950
lc = self.leading_coefficient()
2951-
n, u = lc.canonical_associate()
2951+
_, u = lc.canonical_associate()
29522952
return (u.inverse_of_unit() * self, u)
29532953

29542954

src/sage/rings/polynomial/polynomial_element.pyx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ import sage.rings.fraction_field_element
7474
import sage.rings.infinity as infinity
7575
from sage.misc.latex import latex
7676
from sage.arith.power cimport generic_power
77-
from sage.arith.misc import crt
7877
from sage.arith.long cimport pyobject_to_long
79-
from sage.misc.mrange import cartesian_product_iterator
8078
from sage.structure.factorization import Factorization
8179
from sage.structure.richcmp cimport (richcmp, richcmp_item,
8280
rich_to_bool, rich_to_bool_sgn)
@@ -6299,7 +6297,7 @@ cdef class Polynomial(CommutativePolynomial):
62996297
(2*x^2 - 3*x - 5, -1)
63006298
"""
63016299
lc = self.leading_coefficient()
6302-
n, u = lc.canonical_associate()
6300+
_, u = lc.canonical_associate()
63036301
return (u.inverse_of_unit() * self, u)
63046302

63056303
def lm(self):

src/sage/rings/rational.pyx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,6 @@ cdef class Rational(sage.structure.element.FieldElement):
586586
cdef __set_value(self, x, unsigned int base):
587587
cdef int n
588588
cdef Rational temp_rational
589-
cdef integer.Integer a, b
590589

591590
if isinstance(x, Rational):
592591
set_from_Rational(self, x)
@@ -610,7 +609,6 @@ cdef class Rational(sage.structure.element.FieldElement):
610609
xstr = x.str(base, truncate=(base == 10))
611610
if '.' in xstr:
612611
exp = (len(xstr) - (xstr.index('.') +1))
613-
p = base**exp
614612
pstr = '1'+'0'*exp
615613
s = xstr.replace('.','') +'/'+pstr
616614
n = mpq_set_str(self.value, str_to_bytes(s), base)
@@ -1880,7 +1878,7 @@ cdef class Rational(sage.structure.element.FieldElement):
18801878
return self
18811879
a = self
18821880
for p in S:
1883-
e, a = a.val_unit(p)
1881+
_, a = a.val_unit(p)
18841882
return a
18851883

18861884
def sqrt(self, prec=None, extend=True, all=False):
@@ -2044,10 +2042,9 @@ cdef class Rational(sage.structure.element.FieldElement):
20442042
sage: RealField(200)(x) # needs sage.rings.real_mpfr
20452043
3.1415094339622641509433962264150943396226415094339622641509
20462044
"""
2047-
cdef unsigned int alpha, beta
20482045
d = self.denominator()
2049-
alpha, d = d.val_unit(2)
2050-
beta, d = d.val_unit(5)
2046+
_, d = d.val_unit(2)
2047+
_, d = d.val_unit(5)
20512048
from sage.rings.finite_rings.integer_mod import Mod
20522049
return Mod(10, d).multiplicative_order()
20532050

@@ -2810,7 +2807,7 @@ cdef class Rational(sage.structure.element.FieldElement):
28102807
...
28112808
ArithmeticError: The inverse of 0 modulo 17 is not defined.
28122809
"""
2813-
cdef unsigned int num, den, a
2810+
cdef unsigned int num, den
28142811

28152812
# Documentation from GMP manual:
28162813
# "For the ui variants the return value is the remainder, and

src/sage/rings/ring_extension.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,16 +479,16 @@ class RingExtensionFactory(UniqueFactory):
479479
sage: RingExtension.create_object((8,9,0), key, **extra_args)
480480
Rational Field over its base
481481
"""
482-
defining_morphism, gens, names = key
482+
defining_morphism, _, _ = key
483483
constructors = extra_args['constructors']
484484
if len(constructors) == 0:
485485
raise NotImplementedError("no constructor available for this extension")
486-
for (constructor, kwargs) in constructors[:-1]:
486+
for constructor, kwargs in constructors[:-1]:
487487
try:
488488
return constructor(defining_morphism, **kwargs)
489489
except (NotImplementedError, ValueError, TypeError):
490490
pass
491-
(constructor, kwargs) = constructors[-1]
491+
constructor, kwargs = constructors[-1]
492492
return constructor(defining_morphism, **kwargs)
493493

494494

src/sage/rings/ring_extension_morphism.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -835,20 +835,20 @@ cdef class MapRelativeRingToFreeModule(Map):
835835
# We compute the matrix of our isomorphism (over base)
836836
from sage.rings.ring_extension import common_base
837837
base = common_base(K, L, False)
838-
EK, iK, jK = K.free_module(base, map=True)
839-
EL, iL, jL = L.free_module(base, map=True)
838+
EK, iK, _ = K.free_module(base, map=True)
839+
_, _, jL = L.free_module(base, map=True)
840840

841841
self._dimK = EK.dimension()
842842
self._iK = iK
843843
self._jL = jL
844844

845-
M = [ ]
845+
M = []
846846
for x in self._basis:
847847
for v in EK.basis():
848848
y = x * f(iK(v))
849849
M.append(jL(y))
850850
from sage.matrix.matrix_space import MatrixSpace
851-
self._matrix = MatrixSpace(base,len(M))(M).inverse_of_unit()
851+
self._matrix = MatrixSpace(base, len(M))(M).inverse_of_unit()
852852

853853
def is_injective(self):
854854
r"""

src/sage/rings/tate_algebra_element.pyx

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,8 +1170,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement):
11701170
sage: A(x + 2*x^2 + x^3, prec=5)
11711171
...00001*x^3 + ...00001*x + ...00010*x^2 + O(2^5 * <x, y>)
11721172
"""
1173-
base = self._parent.base_ring()
1174-
nvars = self._parent.ngens()
11751173
vars = self._parent.variable_names()
11761174
s = ""
11771175
for t in self._terms_c():
@@ -1229,9 +1227,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement):
12291227
sage: f._latex_()
12301228
'...0000000001x^{3} + ...0000000001x + ...00000000010x^{2}'
12311229
"""
1232-
base = self._parent.base_ring()
1233-
nvars = self._parent.ngens()
1234-
vars = self._parent.variable_names()
12351230
s = ""
12361231
for t in self.terms():
12371232
if t.valuation() >= self._prec:
@@ -1246,7 +1241,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement):
12461241
if self._prec is not Infinity:
12471242
if s != "":
12481243
s += " + "
1249-
sv = ",".join(vars)
12501244
if self._prec == 0:
12511245
s += "O\\left(%s\\right)" % self._parent.integer_ring()._latex_()
12521246
elif self._prec == 1:
@@ -1968,16 +1962,15 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement):
19681962
parent = self._parent
19691963
base = parent.base_ring()
19701964
if base.is_field():
1971-
for (e,c) in self._poly.__repn.items():
1965+
for e, c in self._poly.__repn.items():
19721966
coeffs[e] = c << n
19731967
ans._prec = self._prec + n
19741968
else:
19751969
field = base.fraction_field()
1976-
ngens = parent.ngens()
1977-
for (e,c) in self._poly.__repn.items():
1970+
for e, c in self._poly.__repn.items():
19781971
minval = ZZ(e.dotprod(<ETuple>parent._log_radii)).ceil()
19791972
coeffs[e] = field(base(c) >> (minval-n)) << minval
1980-
ans._prec = max(ZZ(0), self._prec + n)
1973+
ans._prec = max(ZZ.zero(), self._prec + n)
19811974
ans._poly = PolyDict(coeffs, None)
19821975
return ans
19831976

@@ -2453,12 +2446,10 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement):
24532446
sage: f.valuation()
24542447
-4
24552448
"""
2456-
cdef TateAlgebraTerm t
24572449
cdef list terms = self._terms_c()
24582450
if terms:
24592451
return min(terms[0].valuation(), self._prec)
2460-
else:
2461-
return self._prec
2452+
return self._prec
24622453

24632454
def precision_relative(self):
24642455
"""
@@ -3244,7 +3235,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement):
32443235
divisors = [divisors]
32453236
onedivisor = True
32463237
A = _pushout_family(divisors, self._parent)
3247-
f = A(self)
32483238
divisors = [A(d) for d in divisors]
32493239
q, r = (<TateAlgebraElement>self)._quo_rem_c(divisors, quo, rem, False)
32503240
if quo and onedivisor:

src/sage/rings/tate_algebra_ideal.pyx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ def groebner_basis_buchberger(I, prec, py_integral):
432432
...0000000001*x^2*y + ...1210121020 + O(3^10 * <x, y>),
433433
...000000001*y^2 + ...210121020*x + O(3^9 * <x, y>)]
434434
"""
435-
cdef list gb, rgb, indices, ts, S = [ ]
435+
cdef list gb, rgb, indices, S = [ ]
436436
cdef int i, j, l
437437
cdef TateAlgebraTerm ti, tj, t
438438
cdef TateAlgebraElement f, g, r, s
@@ -642,7 +642,6 @@ cdef TateAlgebraElement regular_reduce(sgb, TateAlgebraTerm s, TateAlgebraElemen
642642
cdef list terms = v._terms_c()
643643
cdef int index = 0
644644
cdef int i
645-
cdef bint in_rem
646645

647646
f = v._new_c()
648647
f._poly = PolyDict(v._poly.__repn, None)
@@ -872,7 +871,6 @@ def groebner_basis_pote(I, prec, verbose=0):
872871
# we add signatures
873872
sgb = [ (None, g) for g in gb if g ]
874873
# We compute initial J-pairs
875-
l = len(sgb)
876874
p = (term_one, f.add_bigoh(prec))
877875
Jpairs = [ ]
878876
for P in sgb:
@@ -1159,7 +1157,6 @@ def groebner_basis_vapote(I, prec, verbose=0, interrupt_red_with_val=False, inte
11591157
# we add signatures
11601158
sgb = [ (None, g) for g in gb if g ]
11611159
# We compute initial J-pairs
1162-
l = len(sgb)
11631160
p = (term_one, f.add_bigoh(prec))
11641161
Jpairs = [ ]
11651162
for P in sgb:

0 commit comments

Comments
 (0)