Skip to content

Commit 39dfddd

Browse files
committedSep 5, 2023
fix suggested details
1 parent 050d0aa commit 39dfddd

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed
 

‎src/sage/rings/number_field/homset.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def _an_element_(self):
143143
else:
144144
from sage.categories.sets_cat import EmptySetError
145145
raise EmptySetError("There is no morphism from {} to {}".format(
146-
self.domain(), self.codomain()))
146+
self.domain(), self.codomain()))
147147

148148
def _repr_(self):
149149
r"""
@@ -238,7 +238,7 @@ def list(self):
238238
v = [D.hom([r], codomain=C, check=False) for r in roots]
239239
else:
240240
v = []
241-
return Sequence(v, universe=self, check=False, immutable=True, cr=v != [])
241+
return Sequence(v, universe=self, check=False, immutable=True, cr=bool(v))
242242

243243
def __getitem__(self, n):
244244
r"""
@@ -389,7 +389,7 @@ def _element_constructor_(self, x, base_map=None, base_hom=None, check=True):
389389
raise ValueError("codomain of absolute homomorphism must be codomain of this homset.")
390390
return self.element_class(self, x)
391391
if (isinstance(x, RelativeNumberFieldHomomorphism_from_abs)
392-
and x.parent() == self):
392+
and x.parent() == self):
393393
return self.element_class(self, x.abs_hom())
394394
if base_map is None:
395395
base_map = self.default_base_hom()
@@ -519,7 +519,7 @@ def list(self):
519519
C = self.codomain()
520520
D_abs = D.absolute_field('a')
521521
v = [self(f, check=False) for f in D_abs.Hom(C).list()]
522-
return Sequence(v, universe=self, check=False, immutable=True, cr=v != [])
522+
return Sequence(v, universe=self, check=False, immutable=True, cr=bool(v))
523523

524524

525525
class CyclotomicFieldHomset(NumberFieldHomset):
@@ -579,7 +579,7 @@ def _element_constructor_(self, x, check=True):
579579
x^2 + b
580580
"""
581581
if (isinstance(x, CyclotomicFieldHomomorphism_im_gens)
582-
and x.parent() == self):
582+
and x.parent() == self):
583583
return self.element_class(self, x.im_gens())
584584
return self.element_class(self, x, check=check)
585585

@@ -622,4 +622,4 @@ def list(self):
622622
else:
623623
w = C.zeta(n)
624624
v = [self([w**k], check=False) for k in Zmod(n) if k.is_unit()]
625-
return Sequence(v, universe=self, check=False, immutable=True, cr=v != [])
625+
return Sequence(v, universe=self, check=False, immutable=True, cr=bool(v))

‎src/sage/rings/number_field/number_field_rel.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ def subfields(self, degree=0, name=None):
463463
if to_K is not None:
464464
to_K = RelativeNumberFieldHomomorphism_from_abs(self.Hom(K), to_K*to_abs)
465465
ans.append((K, from_K, to_K))
466-
ans = Sequence(ans, immutable=True, cr=ans != [])
466+
ans = Sequence(ans, immutable=True, cr=bool(ans))
467467
return ans
468468

469469
def is_absolute(self):
@@ -2077,7 +2077,7 @@ def embeddings(self, K):
20772077
# then it is most natural, so we put it first.
20782078
put_natural_embedding_first(v)
20792079

2080-
self.__embeddings[K] = Sequence(v, cr=v != [], immutable=True, check=False, universe=self.Hom(K))
2080+
self.__embeddings[K] = Sequence(v, cr=bool(v), immutable=True, check=False, universe=self.Hom(K))
20812081
return self.__embeddings[K]
20822082

20832083
def automorphisms(self):
@@ -2152,13 +2152,14 @@ def automorphisms(self):
21522152

21532153
L = self.absolute_field('a')
21542154
L_into_self, self_into_L = L.structure()
2155-
aas = L.automorphisms() # absolute automorphisms
2155+
aas = L.automorphisms() # absolute automorphisms
21562156

21572157
a = self_into_L(self.gen())
21582158
abs_base_gens = [self_into_L(_) for _ in self.base_field().gens()]
2159-
v = sorted([ self.hom([ L_into_self(aa(a)) ]) for aa in aas if all(aa(g) == g for g in abs_base_gens) ])
2159+
v = sorted([self.hom([L_into_self(aa(a))]) for aa in aas
2160+
if all(aa(g) == g for g in abs_base_gens)])
21602161
put_natural_embedding_first(v)
2161-
self.__automorphisms = Sequence(v, cr=(v != []), immutable=True,
2162+
self.__automorphisms = Sequence(v, cr=bool(v), immutable=True,
21622163
check=False, universe=self.Hom(self))
21632164
return self.__automorphisms
21642165

0 commit comments

Comments
 (0)
Please sign in to comment.