Skip to content

Commit 16cd708

Browse files
author
Matthias Koeppe
committed
Use more block tags
1 parent c400a62 commit 16cd708

File tree

7 files changed

+117
-96
lines changed

7 files changed

+117
-96
lines changed

src/sage/databases/cubic_hecke_db.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,11 +1493,12 @@ def read_markov(bas_ele, variables, num_strands=4):
14931493
14941494
EXAMPLES::
14951495
1496+
sage: # needs sympy
14961497
sage: from sage.databases.cubic_hecke_db import read_markov
1497-
sage: from sympy import var # needs sympy
1498-
sage: u, v, w, s = var('u, v, w, s') # needs sympy
1499-
sage: variables = (u, v, w, s) # needs sympy
1500-
sage: read_markov('U2', variables, num_strands=3) # needs sympy
1498+
sage: from sympy import var
1499+
sage: u, v, w, s = var('u, v, w, s')
1500+
sage: variables = (u, v, w, s)
1501+
sage: read_markov('U2', variables, num_strands=3)
15011502
[0, s, 1/s, s, 1/s, 0, 0, 0, 0, -s*v, s, s, -s*u/w, -v/s, 1/s,
15021503
0, 0, 0, 0, 1/s, -u/(s*w), -v/s, 0, 0]
15031504
"""

src/sage/structure/element.pyx

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2000,16 +2000,18 @@ cdef class Element(SageObject):
20002000
20012001
::
20022002
2003-
sage: (2/3)^I # needs sage.symbolic
2003+
sage: # needs sage.symbolic
2004+
sage: (2/3)^I
20042005
(2/3)^I
2005-
sage: (2/3)^sqrt(2) # needs sage.symbolic
2006+
sage: (2/3)^sqrt(2)
20062007
(2/3)^sqrt(2)
2007-
sage: var('x,y,z,n') # needs sage.symbolic
2008+
sage: var('x,y,z,n')
20082009
(x, y, z, n)
2009-
sage: (2/3)^(x^n + y^n + z^n) # needs sage.symbolic
2010+
sage: (2/3)^(x^n + y^n + z^n)
20102011
(2/3)^(x^n + y^n + z^n)
2011-
sage: (-7/11)^(tan(x)+exp(x)) # needs sage.symbolic
2012+
sage: (-7/11)^(tan(x)+exp(x))
20122013
(-7/11)^(e^x + tan(x))
2014+
20132015
sage: float(1.2)**(1/2)
20142016
1.0954451150103321
20152017
sage: complex(1,2)**(1/2) # needs sage.rings.complex_double
@@ -2189,6 +2191,7 @@ cdef class ElementWithCachedMethod(Element):
21892191
category whose element and parent classes define cached methods.
21902192
::
21912193
2194+
sage: # needs sage.misc.cython
21922195
sage: cython_code = ["from sage.structure.element cimport Element, ElementWithCachedMethod",
21932196
....: "from sage.structure.richcmp cimport richcmp",
21942197
....: "cdef class MyBrokenElement(Element):",
@@ -2225,7 +2228,7 @@ cdef class ElementWithCachedMethod(Element):
22252228
....: "from sage.structure.parent cimport Parent",
22262229
....: "cdef class MyParent(Parent):",
22272230
....: " Element = MyElement"]
2228-
sage: cython('\n'.join(cython_code)) # needs sage.misc.cython
2231+
sage: cython('\n'.join(cython_code))
22292232
sage: cython_code = ["from sage.misc.cachefunc import cached_method",
22302233
....: "from sage.misc.cachefunc import cached_in_parent_method",
22312234
....: "from sage.categories.category import Category",
@@ -2248,11 +2251,11 @@ cdef class ElementWithCachedMethod(Element):
22482251
....: " @cached_method",
22492252
....: " def invert(self, x):",
22502253
....: " return -x"]
2251-
sage: cython('\n'.join(cython_code)) # needs sage.misc.cython
2252-
sage: C = MyCategory() # needs sage.misc.cython
2253-
sage: P = MyParent(category=C) # needs sage.misc.cython
2254-
sage: ebroken = MyBrokenElement(P, 5) # needs sage.misc.cython
2255-
sage: e = MyElement(P, 5) # needs sage.misc.cython
2254+
sage: cython('\n'.join(cython_code))
2255+
sage: C = MyCategory()
2256+
sage: P = MyParent(category=C)
2257+
sage: ebroken = MyBrokenElement(P, 5)
2258+
sage: e = MyElement(P, 5)
22562259
22572260
The cached methods inherited by ``MyElement`` works::
22582261
@@ -2892,16 +2895,17 @@ cdef class RingElement(ModuleElement):
28922895
28932896
For polynomial rings, prime is the same as irreducible::
28942897
2898+
sage: # needs sage.libs.singular
28952899
sage: R.<x,y> = QQ[]
2896-
sage: x.is_prime() # needs sage.libs.singular
2900+
sage: x.is_prime()
28972901
True
2898-
sage: (x^2 + y^3).is_prime() # needs sage.libs.singular
2902+
sage: (x^2 + y^3).is_prime()
28992903
True
2900-
sage: (x^2 - y^2).is_prime() # needs sage.libs.singular
2904+
sage: (x^2 - y^2).is_prime()
29012905
False
2902-
sage: R(0).is_prime() # needs sage.libs.singular
2906+
sage: R(0).is_prime()
29032907
False
2904-
sage: R(2).is_prime() # needs sage.libs.singular
2908+
sage: R(2).is_prime()
29052909
False
29062910
29072911
For the Gaussian integers::
@@ -3243,11 +3247,11 @@ cdef class CommutativeRingElement(RingElement):
32433247
32443248
INPUT:
32453249
3246-
- ``extend`` - Whether to make a ring extension containing a square root if ``self`` is not a square (default: ``True``)
3250+
- ``extend`` -- Whether to make a ring extension containing a square root if ``self`` is not a square (default: ``True``)
32473251
3248-
- ``all`` - Whether to return a list of all square roots or just a square root (default: False)
3252+
- ``all`` -- Whether to return a list of all square roots or just a square root (default: False)
32493253
3250-
- ``name`` - Required when ``extend=True`` and ``self`` is not a square. This will be the name of the generator extension.
3254+
- ``name`` -- Required when ``extend=True`` and ``self`` is not a square. This will be the name of the generator extension.
32513255
32523256
OUTPUT:
32533257
@@ -3278,7 +3282,8 @@ cdef class CommutativeRingElement(RingElement):
32783282
sage: x.sqrt()
32793283
Traceback (most recent call last):
32803284
...
3281-
TypeError: Polynomial is not a square. You must specify the name of the square root when using the default extend = True
3285+
TypeError: Polynomial is not a square. You must specify the name
3286+
of the square root when using the default extend = True
32823287
sage: x.sqrt(extend=False)
32833288
Traceback (most recent call last):
32843289
...
@@ -3733,13 +3738,13 @@ cdef class Vector(ModuleElementWithMutability):
37333738
sage: mv.Parent()
37343739
Full RSpace of degree 3 over Integer Ring
37353740
3736-
sage: # needs sage.modules
3741+
sage: # optional - magma, needs sage.modules
37373742
sage: v = vector(QQ, [1/2, 3/4, 5/6])
3738-
sage: mv = magma(v); mv # optional - magma
3743+
sage: mv = magma(v); mv
37393744
(1/2 3/4 5/6)
3740-
sage: mv.Type() # optional - magma
3745+
sage: mv.Type()
37413746
ModTupFldElt
3742-
sage: mv.Parent() # optional - magma
3747+
sage: mv.Parent()
37433748
Full Vector space of degree 3 over Rational Field
37443749
37453750
A more demanding example::

src/sage/structure/indexed_generators.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -464,16 +464,16 @@ def _ascii_art_generator(self, m):
464464
465465
TESTS::
466466
467-
sage: # needs sage.combinat
468-
sage: R = NonCommutativeSymmetricFunctions(QQ).R() # needs sage.modules
469-
sage: ascii_art(R[1,2,2,4]) # needs sage.modules
467+
sage: # needs sage.combinat sage.modules
468+
sage: R = NonCommutativeSymmetricFunctions(QQ).R()
469+
sage: ascii_art(R[1,2,2,4])
470470
R
471471
****
472472
**
473473
**
474474
*
475475
sage: Partitions.options(diagram_str="#", convention="french")
476-
sage: ascii_art(R[1,2,2,4]) # needs sage.modules
476+
sage: ascii_art(R[1,2,2,4])
477477
R
478478
#
479479
##

src/sage/structure/parent.pyx

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,16 +1386,17 @@ cdef class Parent(sage.structure.category_object.CategoryObject):
13861386
ValueError: relations do not all (canonically) map to 0
13871387
under map determined by images of generators
13881388
1389+
sage: # needs sage.rings.finite_rings
13891390
sage: R.<x> = PolynomialRing(GF(7))
1390-
sage: f = R.hom([3], GF(49,'a')) # needs sage.rings.finite_rings
1391-
sage: f # needs sage.rings.finite_rings
1391+
sage: f = R.hom([3], GF(49,'a'))
1392+
sage: f
13921393
Ring morphism:
13931394
From: Univariate Polynomial Ring in x over Finite Field of size 7
13941395
To: Finite Field in a of size 7^2
13951396
Defn: x |--> 3
1396-
sage: f(x + 6) # needs sage.rings.finite_rings
1397+
sage: f(x + 6)
13971398
2
1398-
sage: f(x^2 + 1) # needs sage.rings.finite_rings
1399+
sage: f(x^2 + 1)
13991400
3
14001401
14011402
Natural morphism::
@@ -1823,13 +1824,14 @@ cdef class Parent(sage.structure.category_object.CategoryObject):
18231824
18241825
Some more advanced examples::
18251826
1827+
sage: # needs sage.rings.number_field
18261828
sage: x = QQ['x'].0
18271829
sage: t = abs(ZZ.random_element(10^6))
1828-
sage: K = NumberField(x^2 + 2*3*7*11, "a"+str(t)) # needs sage.rings.number_field
1829-
sage: a = K.gen() # needs sage.rings.number_field
1830-
sage: K_into_MS = K.hom([a.matrix()]) # needs sage.rings.number_field
1831-
sage: K._unset_coercions_used() # needs sage.rings.number_field
1832-
sage: K.register_embedding(K_into_MS) # needs sage.rings.number_field
1830+
sage: K = NumberField(x^2 + 2*3*7*11, "a"+str(t))
1831+
sage: a = K.gen()
1832+
sage: K_into_MS = K.hom([a.matrix()])
1833+
sage: K._unset_coercions_used()
1834+
sage: K.register_embedding(K_into_MS)
18331835
18341836
sage: # needs sage.rings.number_field
18351837
sage: L = NumberField(x^2 + 2*3*7*11*19*31,
@@ -2131,13 +2133,14 @@ cdef class Parent(sage.structure.category_object.CategoryObject):
21312133
21322134
The following was fixed in :trac:`12969`::
21332135
2136+
sage: # needs sage.combinat sage.modules
21342137
sage: R = QQ['q,t'].fraction_field()
2135-
sage: Sym = sage.combinat.sf.sf.SymmetricFunctions(R) # needs sage.combinat sage.modules
2136-
sage: H = Sym.macdonald().H() # needs sage.combinat sage.modules
2137-
sage: P = Sym.macdonald().P() # needs sage.combinat sage.modules
2138-
sage: m = Sym.monomial() # needs sage.combinat sage.modules
2139-
sage: Ht = Sym.macdonald().Ht() # needs sage.combinat sage.modules
2140-
sage: phi = m.coerce_map_from(P) # needs sage.combinat sage.modules
2138+
sage: Sym = sage.combinat.sf.sf.SymmetricFunctions(R)
2139+
sage: H = Sym.macdonald().H()
2140+
sage: P = Sym.macdonald().P()
2141+
sage: m = Sym.monomial()
2142+
sage: Ht = Sym.macdonald().Ht()
2143+
sage: phi = m.coerce_map_from(P)
21412144
"""
21422145
return copy(self._internal_coerce_map_from(S))
21432146

@@ -2167,16 +2170,17 @@ cdef class Parent(sage.structure.category_object.CategoryObject):
21672170
From: Integer Ring
21682171
To: Rational Field
21692172
2173+
sage: # needs sage.combinat sage.modules
21702174
sage: R = QQ['q,t'].fraction_field()
2171-
sage: Sym = sage.combinat.sf.sf.SymmetricFunctions(R) # needs sage.combinat sage.modules
2172-
sage: P = Sym.macdonald().P() # needs sage.combinat sage.modules
2173-
sage: Ht = Sym.macdonald().Ht() # needs sage.combinat sage.modules
2174-
sage: Ht._internal_coerce_map_from(P) # needs sage.combinat sage.modules
2175+
sage: Sym = sage.combinat.sf.sf.SymmetricFunctions(R)
2176+
sage: P = Sym.macdonald().P()
2177+
sage: Ht = Sym.macdonald().Ht()
2178+
sage: Ht._internal_coerce_map_from(P)
21752179
(map internal to coercion system -- copy before use)
21762180
Composite map:
21772181
From: Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field in the Macdonald P basis
21782182
To: Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field in the Macdonald Ht basis
2179-
sage: copy(Ht._internal_coerce_map_from(P)) # needs sage.combinat sage.modules
2183+
sage: copy(Ht._internal_coerce_map_from(P))
21802184
Composite map:
21812185
From: Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field in the Macdonald P basis
21822186
To: Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field in the Macdonald Ht basis

src/sage/structure/parent_gens.pyx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -244,18 +244,20 @@ cdef class ParentWithGens(ParentWithBase):
244244
sage: f = R.hom([5], GF(7))
245245
Traceback (most recent call last):
246246
...
247-
ValueError: relations do not all (canonically) map to 0 under map determined by images of generators
247+
ValueError: relations do not all (canonically) map to 0
248+
under map determined by images of generators
248249
250+
sage: # needs sage.rings.finite_rings
249251
sage: R.<x> = PolynomialRing(GF(7))
250-
sage: f = R.hom([3], GF(49, 'a')) # needs sage.rings.finite_rings
251-
sage: f # needs sage.rings.finite_rings
252+
sage: f = R.hom([3], GF(49, 'a'))
253+
sage: f
252254
Ring morphism:
253255
From: Univariate Polynomial Ring in x over Finite Field of size 7
254256
To: Finite Field in a of size 7^2
255257
Defn: x |--> 3
256-
sage: f(x + 6) # needs sage.rings.finite_rings
258+
sage: f(x + 6)
257259
2
258-
sage: f(x^2 + 1) # needs sage.rings.finite_rings
260+
sage: f(x^2 + 1)
259261
3
260262
261263
EXAMPLES: Natural morphism
@@ -281,15 +283,17 @@ cdef class ParentWithGens(ParentWithBase):
281283
282284
You can specify a map on the base ring::
283285
286+
sage: # needs sage.rings.finite_rings
284287
sage: k = GF(2)
285288
sage: R.<a> = k[]
286-
sage: l.<a> = k.extension(a^3 + a^2 + 1) # needs sage.rings.finite_rings
287-
sage: R.<b> = l[] # needs sage.rings.finite_rings
288-
sage: m.<b> = l.extension(b^2 + b + a) # needs sage.rings.finite_rings
289-
sage: n.<z> = GF(2^6) # needs sage.rings.finite_rings
290-
sage: m.hom([z^4 + z^3 + 1], base_map=l.hom([z^5 + z^4 + z^2])) # needs sage.rings.finite_rings
289+
sage: l.<a> = k.extension(a^3 + a^2 + 1)
290+
sage: R.<b> = l[]
291+
sage: m.<b> = l.extension(b^2 + b + a)
292+
sage: n.<z> = GF(2^6)
293+
sage: m.hom([z^4 + z^3 + 1], base_map=l.hom([z^5 + z^4 + z^2]))
291294
Ring morphism:
292-
From: Univariate Quotient Polynomial Ring in b over Finite Field in a of size 2^3 with modulus b^2 + b + a
295+
From: Univariate Quotient Polynomial Ring in b over
296+
Finite Field in a of size 2^3 with modulus b^2 + b + a
293297
To: Finite Field in z of size 2^6
294298
Defn: b |--> z^4 + z^3 + 1
295299
with map of base ring

src/sage/structure/parent_old.pyx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,22 @@ cdef class Parent(parent.Parent):
4646
4747
TESTS::
4848
49-
sage: V = VectorSpace(GF(2,'a'), 2) # needs sage.modules
50-
sage: V.list() # needs sage.modules
49+
sage: # needs sage.modules
50+
sage: V = VectorSpace(GF(2,'a'), 2)
51+
sage: V.list()
5152
[(0, 0), (1, 0), (0, 1), (1, 1)]
52-
sage: MatrixSpace(GF(3), 1, 1).list() # needs sage.modules
53+
sage: MatrixSpace(GF(3), 1, 1).list()
5354
[[0], [1], [2]]
54-
sage: DirichletGroup(3).list() # needs sage.groups
55+
sage: DirichletGroup(3).list() # needs sage.modular
5556
[Dirichlet character modulo 3 of conductor 1 mapping 2 |--> 1,
5657
Dirichlet character modulo 3 of conductor 3 mapping 2 |--> -1]
57-
sage: K = GF(7^6,'a') # needs sage.rings.finite_rings
58-
sage: K.list()[:10] # long time # needs sage.rings.finite_rings
58+
59+
sage: # needs sage.rings.finite_rings
60+
sage: K = GF(7^6,'a')
61+
sage: K.list()[:10] # long time
5962
[0, 1, 2, 3, 4, 5, 6, a, a + 1, a + 2]
60-
sage: K.<a> = GF(4) # needs sage.rings.finite_rings
61-
sage: K.list() # needs sage.rings.finite_rings
63+
sage: K.<a> = GF(4)
64+
sage: K.list()
6265
[0, a, a + 1, 1]
6366
"""
6467

0 commit comments

Comments
 (0)