@@ -122,7 +122,7 @@ from sage.structure.category_object import normalize_names
122
122
from sage.categories.map cimport Map
123
123
from sage.categories.commutative_rings import CommutativeRings
124
124
from sage.categories.fields import Fields
125
- from sage.rings.ring cimport CommutativeRing, CommutativeAlgebra
125
+ from sage.rings.ring cimport CommutativeRing
126
126
from sage.rings.integer_ring import ZZ
127
127
from sage.rings.infinity import Infinity
128
128
@@ -174,8 +174,8 @@ def tower_bases(ring, degree):
174
174
5-adic Field with capped relative precision 20 ],
175
175
[1, 3, 6 ])
176
176
"""
177
- bases = [ ]
178
- degrees = [ ]
177
+ bases = []
178
+ degrees = []
179
179
base = ring
180
180
deg = 1
181
181
while True :
@@ -454,7 +454,7 @@ class RingExtensionFactory(UniqueFactory):
454
454
455
455
# We figure out what are the best constructors
456
456
if constructors is None :
457
- constructors = [ ]
457
+ constructors = []
458
458
if gens is not None and len (gens) == 1 :
459
459
constructors.append((RingExtensionWithGen,
460
460
{' gen' : gens[0 ], ' names' : names,
@@ -498,7 +498,7 @@ RingExtension = RingExtensionFactory("sage.rings.ring_extension.RingExtension")
498
498
# General extensions
499
499
# ###################
500
500
501
- cdef class RingExtension_generic(CommutativeAlgebra ):
501
+ cdef class RingExtension_generic(CommutativeRing ):
502
502
r """
503
503
A generic class for all ring extensions.
504
504
@@ -580,7 +580,7 @@ cdef class RingExtension_generic(CommutativeAlgebra):
580
580
# but CommutativeRings() seems safer, especially when dealing with
581
581
# morphisms which do not need to preserve the base
582
582
category = CommutativeRings()
583
- CommutativeAlgebra .__init__ (self , ZZ, category = category)
583
+ CommutativeRing .__init__ (self , ZZ, category = category)
584
584
self ._base = base
585
585
self ._backend = ring
586
586
self ._backend_defining_morphism = defining_morphism
@@ -1135,7 +1135,7 @@ cdef class RingExtension_generic(CommutativeAlgebra):
1135
1135
1136
1136
:meth:`base`, :meth:`absolute_base`, :meth:`is_defined_over`
1137
1137
"""
1138
- L = [ self ]
1138
+ L = [self ]
1139
1139
base = self
1140
1140
while isinstance (base, RingExtension_generic):
1141
1141
base = base.base_ring()
@@ -1358,7 +1358,8 @@ cdef class RingExtension_generic(CommutativeAlgebra):
1358
1358
( y, x)
1359
1359
"""
1360
1360
self ._check_base(base)
1361
- return tuple ([ self (x) for x in generators(self ._backend, backend_parent(self ._base)) ])
1361
+ return tuple ([self (x) for x in generators(self ._backend,
1362
+ backend_parent(self ._base))])
1362
1363
1363
1364
def ngens (self , base = None ):
1364
1365
r """
@@ -2026,7 +2027,6 @@ cdef class RingExtensionFractionField(RingExtension_generic):
2026
2027
Maximal Order generated by a in Number Field in a
2027
2028
with defining polynomial x^ 2 - 2 over its base
2028
2029
sage: TestSuite( K) . run( )
2029
-
2030
2030
"""
2031
2031
RingExtension_generic.__init__ (self , defining_morphism, ** kwargs)
2032
2032
if ring is None :
@@ -2138,9 +2138,9 @@ cdef class RingExtensionWithBasis(RingExtension_generic):
2138
2138
sage: TestSuite( E) . run( ) # needs sage. rings. number_field
2139
2139
"""
2140
2140
RingExtension_generic.__init__ (self , defining_morphism, ** kwargs)
2141
- self ._basis = [ self (b) for b in basis ]
2141
+ self ._basis = [self (b) for b in basis]
2142
2142
if names is None :
2143
- names = [ ]
2143
+ names = []
2144
2144
for b in self ._basis:
2145
2145
b = b._backend
2146
2146
if b == 1 :
@@ -2154,7 +2154,7 @@ cdef class RingExtensionWithBasis(RingExtension_generic):
2154
2154
if len (names) != len (self ._basis):
2155
2155
raise ValueError (" the number of names does not match the cardinality of the basis" )
2156
2156
self ._basis_names = names
2157
- self ._basis_latex_names = [ latex_variable_name(name) for name in names ]
2157
+ self ._basis_latex_names = [latex_variable_name(name) for name in names]
2158
2158
self ._names = tuple (names)
2159
2159
if check:
2160
2160
try :
@@ -2335,12 +2335,11 @@ cdef class RingExtensionWithBasis(RingExtension_generic):
2335
2335
[1, u, u^2 ]
2336
2336
"""
2337
2337
if base is self :
2338
- return [ self .one() ]
2339
- elif base is self ._base:
2338
+ return [self .one()]
2339
+ if base is self ._base:
2340
2340
return self ._basis[:]
2341
- else :
2342
- b = self ._base._basis_over(base)
2343
- return [ x* y for x in self ._basis for y in b ]
2341
+ b = self ._base._basis_over(base)
2342
+ return [x * y for x in self ._basis for y in b]
2344
2343
2345
2344
def free_module (self , base = None , map = True ):
2346
2345
r """
@@ -2461,8 +2460,8 @@ cdef class RingExtensionWithBasis(RingExtension_generic):
2461
2460
sage: L = GF( 7^ 15) . over( K) # needs sage. rings. finite_rings
2462
2461
sage: for base in L. bases( ) : # needs sage. rings. finite_rings
2463
2462
.... : V, i, j = L. free_module( base)
2464
- .... : assert( [ i(v) for v in V.basis() ] == L. basis_over( base))
2465
- .... : assert( [ j(x) for x in L.basis_over(base) ] == V. basis( ))
2463
+ .... : assert( [i(v) for v in V.basis() ] == L. basis_over( base))
2464
+ .... : assert( [j(x) for x in L.basis_over(base) ] == V. basis( ))
2466
2465
2467
2466
"""
2468
2467
d = self ._degree_over(base)
@@ -2599,15 +2598,15 @@ cdef class RingExtensionWithGen(RingExtensionWithBasis):
2599
2598
backend_base = backend_parent(defining_morphism.domain())
2600
2599
_, deg_domain, deg_codomain = common_base(backend_base, defining_morphism.codomain(), True )
2601
2600
degree = deg_codomain // deg_domain
2602
- basis_names = [ " " ]
2603
- basis_latex_names = [ " " ]
2601
+ basis_names = [" " ]
2602
+ basis_latex_names = [" " ]
2604
2603
if degree == 1 :
2605
2604
self ._name = None
2606
2605
else :
2607
- basis_names += [ self ._name ] + [ " %s ^%s " % (self ._name, i) for i in range (2 ,degree) ]
2606
+ basis_names += [self ._name] + [" %s ^%s " % (self ._name, i) for i in range (2 , degree)]
2608
2607
latex_name = latex_variable_name(self ._name)
2609
- basis_latex_names += [ latex_name ] + [ " %s ^{%s }" % (latex_name, i) for i in range (2 ,degree) ]
2610
- basis = [ gen ** i for i in range (degree) ]
2608
+ basis_latex_names += [latex_name] + [" %s ^{%s }" % (latex_name, i) for i in range (2 , degree)]
2609
+ basis = [gen ** i for i in range (degree)]
2611
2610
RingExtensionWithBasis.__init__ (self , defining_morphism, basis, basis_names, check, ** kwargs)
2612
2611
self ._gen = self ._backend(gen)
2613
2612
self ._names = (self ._name,)
@@ -2681,7 +2680,7 @@ cdef class RingExtensionWithGen(RingExtensionWithBasis):
2681
2680
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
2682
2681
_, _, j = self .free_module(map = True )
2683
2682
d = self .relative_degree()
2684
- coeffs = [ - c for c in j(self ._gen** d) ] + [ 1 ]
2683
+ coeffs = [- c for c in j(self ._gen** d)] + [1 ]
2685
2684
S = PolynomialRing(self ._base, name = var)
2686
2685
return S(coeffs)
2687
2686
0 commit comments