Skip to content

Commit

Permalink
Merge branch 'sage_rings_optional_annotations' into sd117_more_option…
Browse files Browse the repository at this point in the history
…al_doctest_tags
  • Loading branch information
Matthias Koeppe committed Apr 8, 2023
2 parents 49f068f + a0e7176 commit 82fa637
Show file tree
Hide file tree
Showing 52 changed files with 4,548 additions and 4,437 deletions.
58 changes: 29 additions & 29 deletions src/sage/rings/abc.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ class NumberField_quadratic(Field):
EXAMPLES::
sage: import sage.rings.abc
sage: K.<sqrt2> = QuadraticField(2) # optional - sage.rings.number_field
sage: isinstance(K, sage.rings.abc.NumberField_quadratic) # optional - sage.rings.number_field
sage: K.<sqrt2> = QuadraticField(2) # optional - sage.rings.number_field
sage: isinstance(K, sage.rings.abc.NumberField_quadratic) # optional - sage.rings.number_field
True
By design, there is a unique direct subclass::
sage: sage.rings.abc.NumberField_quadratic.__subclasses__() # optional - sage.rings.number_field
sage: sage.rings.abc.NumberField_quadratic.__subclasses__() # optional - sage.rings.number_field
[<class 'sage.rings.number_field.number_field.NumberField_quadratic'>]
sage: len(sage.rings.abc.NumberField_quadratic.__subclasses__()) <= 1
Expand All @@ -40,13 +40,13 @@ class NumberField_cyclotomic(Field):
EXAMPLES::
sage: import sage.rings.abc
sage: K.<zeta> = CyclotomicField(15) # optional - sage.rings.number_field
sage: isinstance(K, sage.rings.abc.NumberField_cyclotomic) # optional - sage.rings.number_field
sage: K.<zeta> = CyclotomicField(15) # optional - sage.rings.number_field
sage: isinstance(K, sage.rings.abc.NumberField_cyclotomic) # optional - sage.rings.number_field
True
By design, there is a unique direct subclass::
sage: sage.rings.abc.NumberField_cyclotomic.__subclasses__() # optional - sage.rings.number_field
sage: sage.rings.abc.NumberField_cyclotomic.__subclasses__() # optional - sage.rings.number_field
[<class 'sage.rings.number_field.number_field.NumberField_cyclotomic'>]
sage: len(sage.rings.abc.NumberField_cyclotomic.__subclasses__()) <= 1
Expand All @@ -66,16 +66,16 @@ class AlgebraicField_common(Field):
EXAMPLES::
sage: import sage.rings.abc
sage: isinstance(QQbar, sage.rings.abc.AlgebraicField_common) # optional - sage.rings.number_field
sage: isinstance(QQbar, sage.rings.abc.AlgebraicField_common) # optional - sage.rings.number_field
True
sage: isinstance(AA, sage.rings.abc.AlgebraicField_common) # optional - sage.rings.number_field
sage: isinstance(AA, sage.rings.abc.AlgebraicField_common) # optional - sage.rings.number_field
True
By design, other than the abstract subclasses :class:`~sage.rings.abc.AlgebraicField`
and :class:`~sage.rings.abc.AlgebraicRealField`, there is only one direct implementation
subclass::
sage: sage.rings.abc.AlgebraicField_common.__subclasses__() # optional - sage.rings.number_field
sage: sage.rings.abc.AlgebraicField_common.__subclasses__() # optional - sage.rings.number_field
[<class 'sage.rings.abc.AlgebraicField'>,
<class 'sage.rings.abc.AlgebraicRealField'>,
<class 'sage.rings.qqbar.AlgebraicField_common'>]
Expand All @@ -97,14 +97,14 @@ class AlgebraicField(AlgebraicField_common):
EXAMPLES::
sage: import sage.rings.abc
sage: isinstance(QQbar, sage.rings.abc.AlgebraicField) # optional - sage.rings.number_field
sage: isinstance(QQbar, sage.rings.abc.AlgebraicField) # optional - sage.rings.number_field
True
sage: isinstance(AA, sage.rings.abc.AlgebraicField) # optional - sage.rings.number_field
sage: isinstance(AA, sage.rings.abc.AlgebraicField) # optional - sage.rings.number_field
False
By design, there is a unique direct subclass::
sage: sage.rings.abc.AlgebraicField.__subclasses__() # optional - sage.rings.number_field
sage: sage.rings.abc.AlgebraicField.__subclasses__() # optional - sage.rings.number_field
[<class 'sage.rings.qqbar.AlgebraicField'>]
sage: len(sage.rings.abc.AlgebraicField.__subclasses__()) <= 1
Expand All @@ -124,14 +124,14 @@ class AlgebraicRealField(AlgebraicField_common):
EXAMPLES::
sage: import sage.rings.abc
sage: isinstance(QQbar, sage.rings.abc.AlgebraicRealField) # optional - sage.rings.number_field
sage: isinstance(QQbar, sage.rings.abc.AlgebraicRealField) # optional - sage.rings.number_field
False
sage: isinstance(AA, sage.rings.abc.AlgebraicRealField) # optional - sage.rings.number_field
sage: isinstance(AA, sage.rings.abc.AlgebraicRealField) # optional - sage.rings.number_field
True
By design, there is a unique direct subclass::
sage: sage.rings.abc.AlgebraicRealField.__subclasses__() # optional - sage.rings.number_field
sage: sage.rings.abc.AlgebraicRealField.__subclasses__() # optional - sage.rings.number_field
[<class 'sage.rings.qqbar.AlgebraicRealField'>]
sage: len(sage.rings.abc.AlgebraicRealField.__subclasses__()) <= 1
Expand Down Expand Up @@ -376,13 +376,13 @@ class Order:
EXAMPLES::
sage: import sage.rings.abc
sage: K.<a> = NumberField(x^2 + 1); O = K.order(2*a) # optional - sage.rings.number_field
sage: isinstance(O, sage.rings.abc.Order) # optional - sage.rings.number_field
sage: K.<a> = NumberField(x^2 + 1); O = K.order(2*a) # optional - sage.rings.number_field
sage: isinstance(O, sage.rings.abc.Order) # optional - sage.rings.number_field
True
By design, there is a unique direct subclass::
sage: sage.rings.abc.Order.__subclasses__() # optional - sage.rings.number_field
sage: sage.rings.abc.Order.__subclasses__() # optional - sage.rings.number_field
[<class 'sage.rings.number_field.order.Order'>]
sage: len(sage.rings.abc.Order.__subclasses__()) <= 1
Expand All @@ -402,14 +402,14 @@ class pAdicRing(EuclideanDomain):
EXAMPLES::
sage: import sage.rings.abc
sage: isinstance(Zp(5), sage.rings.abc.pAdicRing) # optional - sage.rings.padics
sage: isinstance(Zp(5), sage.rings.abc.pAdicRing) # optional - sage.rings.padics
True
sage: isinstance(Qp(5), sage.rings.abc.pAdicRing) # optional - sage.rings.padics
sage: isinstance(Qp(5), sage.rings.abc.pAdicRing) # optional - sage.rings.padics
False
By design, there is a unique direct subclass::
sage: sage.rings.abc.pAdicRing.__subclasses__() # optional - sage.rings.padics
sage: sage.rings.abc.pAdicRing.__subclasses__() # optional - sage.rings.padics
[<class 'sage.rings.padics.generic_nodes.pAdicRingGeneric'>]
sage: len(sage.rings.abc.pAdicRing.__subclasses__()) <= 1
Expand All @@ -429,14 +429,14 @@ class pAdicField(Field):
EXAMPLES::
sage: import sage.rings.abc
sage: isinstance(Zp(5), sage.rings.abc.pAdicField) # optional - sage.rings.padics
sage: isinstance(Zp(5), sage.rings.abc.pAdicField) # optional - sage.rings.padics
False
sage: isinstance(Qp(5), sage.rings.abc.pAdicField) # optional - sage.rings.padics
sage: isinstance(Qp(5), sage.rings.abc.pAdicField) # optional - sage.rings.padics
True
By design, there is a unique direct subclass::
sage: sage.rings.abc.pAdicField.__subclasses__() # optional - sage.rings.padics
sage: sage.rings.abc.pAdicField.__subclasses__() # optional - sage.rings.padics
[<class 'sage.rings.padics.generic_nodes.pAdicFieldGeneric'>]
sage: len(sage.rings.abc.pAdicField.__subclasses__()) <= 1
Expand All @@ -456,13 +456,13 @@ cdef class SymbolicRing(CommutativeRing):
EXAMPLES::
sage: import sage.rings.abc
sage: isinstance(SR, sage.rings.abc.SymbolicRing) # optional - sage.symbolic
sage: isinstance(SR, sage.rings.abc.SymbolicRing) # optional - sage.symbolic
True
By design, other than the abstract subclass :class:`~sage.rings.abc.CallableSymbolicExpressionRing`,
there is only one direct implementation subclass::
sage: sage.rings.abc.SymbolicRing.__subclasses__() # optional - sage.symbolic
sage: sage.rings.abc.SymbolicRing.__subclasses__() # optional - sage.symbolic
[<class 'sage.rings.abc.CallableSymbolicExpressionRing'>,
<class 'sage.symbolic.ring.SymbolicRing'>]
Expand All @@ -483,13 +483,13 @@ class CallableSymbolicExpressionRing(SymbolicRing):
EXAMPLES::
sage: import sage.rings.abc
sage: f = x.function(x).parent() # optional - sage.symbolic
sage: isinstance(f, sage.rings.abc.CallableSymbolicExpressionRing) # optional - sage.symbolic
sage: f = x.function(x).parent() # optional - sage.symbolic
sage: isinstance(f, sage.rings.abc.CallableSymbolicExpressionRing) # optional - sage.symbolic
True
By design, there is a unique direct subclass::
sage: sage.rings.abc.CallableSymbolicExpressionRing.__subclasses__() # optional - sage.symbolic
sage: sage.rings.abc.CallableSymbolicExpressionRing.__subclasses__() # optional - sage.symbolic
[<class 'sage.symbolic.callable.CallableSymbolicExpressionRing_class'>]
sage: len(sage.rings.abc.CallableSymbolicExpressionRing.__subclasses__()) <= 1
Expand Down
38 changes: 19 additions & 19 deletions src/sage/rings/factorint.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,23 @@ cpdef aurifeuillian(n, m, F=None, bint check=True):
EXAMPLES::
sage: from sage.rings.factorint import aurifeuillian
sage: aurifeuillian(2,2)
sage: aurifeuillian(2, 2)
[5, 13]
sage: aurifeuillian(2,2^5)
sage: aurifeuillian(2, 2^5)
[1985, 2113]
sage: aurifeuillian(5,3)
sage: aurifeuillian(5, 3)
[1471, 2851]
sage: aurifeuillian(15,1)
sage: aurifeuillian(15, 1)
[19231, 142111]
sage: aurifeuillian(12,3)
sage: aurifeuillian(12, 3)
Traceback (most recent call last):
...
ValueError: n has to be square-free
sage: aurifeuillian(1,2)
sage: aurifeuillian(1, 2)
Traceback (most recent call last):
...
ValueError: n has to be greater than 1
sage: aurifeuillian(2,0)
sage: aurifeuillian(2, 0)
Traceback (most recent call last):
...
ValueError: m has to be positive
Expand Down Expand Up @@ -129,24 +129,24 @@ cpdef factor_aurifeuillian(n, check=True):
EXAMPLES::
sage: from sage.rings.factorint import factor_aurifeuillian as fa
sage: fa(2^6+1) # optional - sage.libs.pari
sage: fa(2^6 + 1) # optional - sage.libs.pari
[5, 13]
sage: fa(2^58+1) # optional - sage.libs.pari
sage: fa(2^58 + 1) # optional - sage.libs.pari
[536838145, 536903681]
sage: fa(3^3+1) # optional - sage.libs.pari
sage: fa(3^3 + 1) # optional - sage.libs.pari
[4, 1, 7]
sage: fa(5^5-1) # optional - sage.libs.pari
sage: fa(5^5 - 1) # optional - sage.libs.pari
[4, 11, 71]
sage: prod(_) == 5^5-1 # optional - sage.libs.pari
sage: prod(_) == 5^5 - 1 # optional - sage.libs.pari
True
sage: fa(2^4+1) # optional - sage.libs.pari
sage: fa(2^4 + 1) # optional - sage.libs.pari
[17]
sage: fa((6^2*3)^3+1) # optional - sage.libs.pari
sage: fa((6^2*3)^3 + 1) # optional - sage.libs.pari
[109, 91, 127]
TESTS::
sage: for n in [2,3,5,6,30,31,33]: # optional - sage.libs.pari
sage: for n in [2,3,5,6,30,31,33]: # optional - sage.libs.pari
....: for m in [8,96,109201283]:
....: s = -1 if n % 4 == 1 else 1
....: y = (m^2*n)^n + s
Expand Down Expand Up @@ -222,7 +222,7 @@ def factor_cunningham(m, proof=None):
sage: from sage.rings.factorint import factor_cunningham
sage: factor_cunningham(2^257-1) # optional - cunningham_tables
535006138814359 * 1155685395246619182673033 * 374550598501810936581776630096313181393
sage: factor_cunningham((3^101+1)*(2^60).next_prime(),proof=False) # optional - cunningham_tables
sage: factor_cunningham((3^101+1)*(2^60).next_prime(), proof=False) # optional - cunningham_tables
2^2 * 379963 * 1152921504606847009 * 1017291527198723292208309354658785077827527
"""
Expand Down Expand Up @@ -317,16 +317,16 @@ def factor_using_pari(n, int_=False, debug_level=0, proof=None):
EXAMPLES::
sage: factor(-2**72 + 3, algorithm='pari') # indirect doctest # optional - sage.libs.pari
sage: factor(-2**72 + 3, algorithm='pari') # indirect doctest # optional - sage.libs.pari
-1 * 83 * 131 * 294971519 * 1472414939
Check that PARI's debug level is properly reset (:trac:`18792`)::
sage: alarm(0.5); factor(2^1000 - 1, verbose=5) # optional - sage.libs.pari
sage: alarm(0.5); factor(2^1000 - 1, verbose=5) # optional - sage.libs.pari
Traceback (most recent call last):
...
AlarmInterrupt
sage: pari.get_debug_level() # optional - sage.libs.pari
sage: pari.get_debug_level() # optional - sage.libs.pari
0
"""
from sage.libs.pari.all import pari
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/finite_rings/element_base.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# sage.doctest: optional - sage.libs.pari
# sage.doctest: optional - sage.rings.finite_rings
"""
Base class for finite field elements
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/finite_rings/finite_field_base.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# sage.doctest: optional - sage.libs.pari
# sage.doctest: optional - sage.rings.finite_rings
"""
Base class for finite fields
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/finite_rings/finite_field_constructor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# sage.doctest: optional - sage.libs.pari
# sage.doctest: optional - sage.rings.finite_rings
r"""
Finite fields
Expand Down
Loading

0 comments on commit 82fa637

Please sign in to comment.