Skip to content

Commit 80c1824

Browse files
author
Matthias Koeppe
committed
Doctest cosmetics, add '# optional'
1 parent 30d4209 commit 80c1824

File tree

2 files changed

+25
-30
lines changed

2 files changed

+25
-30
lines changed

src/sage/misc/misc.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,6 @@ def SPYX_TMP():
295295
except KeyError:
296296
pass
297297

298-
#################################################################
299-
# timing
300-
#################################################################
301-
302-
303298

304299
def union(x, y=None):
305300
"""

src/sage/misc/timing.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def cputime(t=0, subprocesses=False):
3737
3838
INPUT:
3939
40-
- ``t`` - (optional) time in CPU seconds, if ``t`` is a result
40+
- ``t`` -- (optional) time in CPU seconds, if ``t`` is a result
4141
from an earlier call with ``subprocesses=True``, then
4242
``subprocesses=True`` is assumed.
4343
@@ -46,26 +46,26 @@ def cputime(t=0, subprocesses=False):
4646
4747
OUTPUT:
4848
49-
- ``float`` - time in CPU seconds if ``subprocesses=False``
49+
- ``float`` -- time in CPU seconds if ``subprocesses=False``
5050
51-
- :class:`GlobalCputime` - object which holds CPU times of
51+
- :class:`GlobalCputime` -- object which holds CPU times of
5252
subprocesses otherwise
5353
5454
EXAMPLES::
5555
5656
sage: t = cputime()
57-
sage: F = gp.factor(2^199-1)
58-
sage: cputime(t) # somewhat random
57+
sage: F = gp.factor(2^199-1) # optional - sage.libs.pari
58+
sage: cputime(t) # somewhat random
5959
0.010999000000000092
6060
6161
sage: t = cputime(subprocesses=True)
62-
sage: F = gp.factor(2^199-1)
63-
sage: cputime(t) # somewhat random
62+
sage: F = gp.factor(2^199-1) # optional - sage.libs.pari
63+
sage: cputime(t) # somewhat random
6464
0.091999
6565
6666
sage: w = walltime()
67-
sage: F = gp.factor(2^199-1)
68-
sage: walltime(w) # somewhat random
67+
sage: F = gp.factor(2^199-1) # optional - sage.libs.pari
68+
sage: walltime(w) # somewhat random
6969
0.58425593376159668
7070
7171
.. NOTE::
@@ -130,24 +130,24 @@ class GlobalCputime:
130130
Objects of this type are returned if ``subprocesses=True`` is
131131
passed to :func:`cputime`::
132132
133-
sage: cputime(subprocesses=True) # indirect doctest, output random
133+
sage: cputime(subprocesses=True) # indirect doctest, output random
134134
0.2347431
135135
136136
We can use it to keep track of the CPU time spent in Singular for
137137
example::
138138
139139
sage: t = cputime(subprocesses=True)
140140
sage: P = PolynomialRing(QQ,7,'x')
141-
sage: I = sage.rings.ideal.Katsura(P)
142-
sage: gb = I.groebner_basis() # calls Singular
143-
sage: cputime(subprocesses=True) - t # output random
141+
sage: I = sage.rings.ideal.Katsura(P) # optional - sage.libs.singular
142+
sage: gb = I.groebner_basis() # calls Singular # optional - sage.libs.singular
143+
sage: cputime(subprocesses=True) - t # output random
144144
0.462987
145145
146146
For further processing we can then convert this container to a
147147
float::
148148
149149
sage: t = cputime(subprocesses=True)
150-
sage: float(t) #output somewhat random
150+
sage: float(t) # output somewhat random
151151
2.1088339999999999
152152
153153
.. SEEALSO::
@@ -173,7 +173,7 @@ def __repr__(self):
173173
"""
174174
EXAMPLES::
175175
176-
sage: cputime(subprocesses=True) # indirect doctest, output random
176+
sage: cputime(subprocesses=True) # indirect doctest, output random
177177
0.2347431
178178
"""
179179
return str(self.total)
@@ -184,8 +184,8 @@ def __add__(self, other):
184184
185185
sage: t = cputime(subprocesses=True)
186186
sage: P = PolynomialRing(QQ,7,'x')
187-
sage: I = sage.rings.ideal.Katsura(P)
188-
sage: gb = I.groebner_basis() # calls Singular
187+
sage: I = sage.rings.ideal.Katsura(P) # optional - sage.libs.singular
188+
sage: gb = I.groebner_basis() # calls Singular # optional - sage.libs.singular
189189
sage: cputime(subprocesses=True) + t # output random
190190
2.798708
191191
"""
@@ -200,8 +200,8 @@ def __sub__(self, other):
200200
201201
sage: t = cputime(subprocesses=True)
202202
sage: P = PolynomialRing(QQ,7,'x')
203-
sage: I = sage.rings.ideal.Katsura(P)
204-
sage: gb = I.groebner_basis() # calls Singular
203+
sage: I = sage.rings.ideal.Katsura(P) # optional - sage.libs.singular
204+
sage: gb = I.groebner_basis() # calls Singular # optional - sage.libs.singular
205205
sage: cputime(subprocesses=True) - t # output random
206206
0.462987
207207
"""
@@ -215,32 +215,32 @@ def __float__(self):
215215
EXAMPLES::
216216
217217
sage: t = cputime(subprocesses=True)
218-
sage: float(t) #output somewhat random
218+
sage: float(t) # output somewhat random
219219
2.1088339999999999
220220
"""
221221
return float(self.total)
222222

223223

224224
def walltime(t=0):
225225
"""
226-
Return the wall time in second, or with optional argument t, return
227-
the wall time since time t. "Wall time" means the time on a wall
226+
Return the wall time in second, or with optional argument ``t``, return
227+
the wall time since time ``t``. "Wall time" means the time on a wall
228228
clock, i.e., the actual time.
229229
230230
INPUT:
231231
232232
233-
- ``t`` - (optional) float, time in CPU seconds
233+
- ``t`` -- (optional) float, time in CPU seconds
234234
235235
OUTPUT:
236236
237-
- ``float`` - time in seconds
237+
- ``float`` -- time in seconds
238238
239239
240240
EXAMPLES::
241241
242242
sage: w = walltime()
243-
sage: F = factor(2^199-1)
243+
sage: F = factor(2^199-1) # optional - sage.libs.pari
244244
sage: walltime(w) # somewhat random
245245
0.8823847770690918
246246
"""

0 commit comments

Comments
 (0)