Skip to content

Commit c7745fe

Browse files
committed
use Parent in QQ
1 parent 9f33709 commit c7745fe

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/sage/rings/rational_field.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
import sage.rings.number_field.number_field_base as number_field_base
6363
from sage.misc.fast_methods import Singleton
6464
from sage.misc.superseded import deprecated_function_alias
65-
from sage.structure.parent_gens import ParentWithGens
65+
from sage.structure.parent import Parent
6666
from sage.structure.sequence import Sequence
6767

6868

@@ -235,8 +235,9 @@ def __init__(self):
235235
"""
236236
from sage.categories.basic import QuotientFields
237237
from sage.categories.number_fields import NumberFields
238-
ParentWithGens.__init__(self, self, category=[QuotientFields().Metric(),
239-
NumberFields()])
238+
Parent.__init__(self, base=self,
239+
category=[QuotientFields().Metric(),
240+
NumberFields()])
240241
self._assign_names(('x',), normalize=False) # ?????
241242
self._populate_coercion_lists_(init_no_parent=True)
242243

@@ -862,7 +863,7 @@ def hilbert_symbol_negative_at_S(self, S, b, check=True):
862863
if p != infty:
863864
if check and not is_prime(p):
864865
raise ValueError("all entries in list must be prime"
865-
" or -1 for infinite place")
866+
" or -1 for infinite place")
866867
R = Qp(p)
867868
if R(b).is_square():
868869
raise ValueError("second argument must be a nonsquare with"
@@ -1055,7 +1056,7 @@ def power_basis(self):
10551056
sage: QQ.power_basis()
10561057
[1]
10571058
"""
1058-
return [ self.gen() ]
1059+
return [self.gen()]
10591060

10601061
def extension(self, poly, names, **kwds):
10611062
r"""
@@ -1133,7 +1134,7 @@ def _an_element_(self):
11331134
sage: QQ.an_element() # indirect doctest
11341135
1/2
11351136
"""
1136-
return Rational((1,2))
1137+
return Rational((1, 2))
11371138

11381139
def some_elements(self):
11391140
r"""
@@ -1247,7 +1248,7 @@ def random_element(self, num_bound=None, den_bound=None, *args, **kwds):
12471248
den = ZZ.random_element(1, den_bound+1, *args, **kwds)
12481249
while den == 0:
12491250
den = ZZ.random_element(1, den_bound+1, *args, **kwds)
1250-
return self((num,den))
1251+
return self((num, den))
12511252

12521253
def zeta(self, n=2):
12531254
"""
@@ -1381,7 +1382,7 @@ def selmer_group_iterator(self, S, m, proof=True):
13811382

13821383
from sage.misc.misc_c import prod
13831384
for ev in product(*[range(o) for o in ords]):
1384-
yield prod((p**e for p,e in zip(KSgens, ev)), one)
1385+
yield prod((p**e for p, e in zip(KSgens, ev)), one)
13851386

13861387
def selmer_space(self, S, p, proof=None):
13871388
r"""
@@ -1520,7 +1521,7 @@ def quadratic_defect(self, a, p, check=True):
15201521
return v + 1
15211522

15221523
#################################
1523-
## Coercions to interfaces
1524+
# Coercions to interfaces
15241525
#################################
15251526
def _gap_init_(self):
15261527
r"""
@@ -1663,7 +1664,7 @@ def _factor_univariate_polynomial(self, f):
16631664
G = list(f._pari_with_name().factor())
16641665

16651666
# normalize the leading coefficients
1666-
F = [(f.parent()(g).monic(), int(e)) for (g,e) in zip(*G)]
1667+
F = [(f.parent()(g).monic(), int(e)) for (g, e) in zip(*G)]
16671668

16681669
from sage.structure.factorization import Factorization
16691670
return Factorization(F, f.leading_coefficient())

0 commit comments

Comments
 (0)