Skip to content

Commit a3b9d24

Browse files
author
Matthias Koeppe
committed
sage.parallel, sage.sets: Update # needs
1 parent 64b28d8 commit a3b9d24

File tree

3 files changed

+28
-20
lines changed

3 files changed

+28
-20
lines changed

src/sage/parallel/decorate.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ def __call__(self, f):
107107
108108
sage: from sage.parallel.decorate import Parallel
109109
sage: p = Parallel()
110-
sage: f = x^2 - 1 # optional - sage.symbolic
111-
sage: p(f) # optional - sage.symbolic
110+
sage: f = x^2 - 1 # needs sage.symbolic
111+
sage: p(f) # needs sage.symbolic
112112
<sage.parallel.decorate.ParallelFunction object at ...>
113113
114114
sage: P = sage.parallel.decorate.Parallel()
@@ -342,7 +342,7 @@ def parallel(p_iter='fork', ncpus=None, **kwds):
342342
343343
sage: @parallel(ncpus=3, timeout=10)
344344
....: def fac(n): return factor(2^n-1)
345-
sage: for X, Y in sorted(list(fac([101,119,151,197,209]))): print((X,Y)) # optional - sage.libs.pari
345+
sage: for X, Y in sorted(list(fac([101,119,151,197,209]))): print((X,Y)) # needs sage.libs.pari
346346
(((101,), {}), 7432339208719 * 341117531003194129)
347347
(((119,), {}), 127 * 239 * 20231 * 131071 * 62983048367 * 131105292137)
348348
(((151,), {}), 18121 * 55871 * 165799 * 2332951 * 7289088383388253664437433)
@@ -531,35 +531,36 @@ def fork(f=None, timeout=0, verbose=False):
531531
We illustrate that the state of the pexpect interface is not altered by
532532
forked functions (they get their own new pexpect interfaces!)::
533533
534-
sage: gp.eval('a = 5') # optional - sage.libs.pari
534+
sage: # needs sage.libs.pari
535+
sage: gp.eval('a = 5')
535536
'5'
536-
sage: @fork() # optional - sage.libs.pari
537+
sage: @fork()
537538
....: def g():
538539
....: gp.eval('a = 10')
539540
....: return gp.eval('a')
540-
sage: g() # optional - sage.libs.pari
541+
sage: g()
541542
'10'
542-
sage: gp.eval('a') # optional - sage.libs.pari
543+
sage: gp.eval('a')
543544
'5'
544545
545546
We illustrate that the forked function has its own pexpect
546547
interface::
547548
548-
sage: gp.eval('a = 15') # optional - sage.libs.pari
549+
sage: gp.eval('a = 15') # needs sage.libs.pari
549550
'15'
550-
sage: @fork() # optional - sage.libs.pari
551+
sage: @fork()
551552
....: def g(): return gp.eval('a')
552-
sage: g() # optional - sage.libs.pari
553+
sage: g() # needs sage.libs.pari
553554
'a'
554555
555556
We illustrate that segfaulting subprocesses are no trouble at all::
556557
557-
sage: cython('def f(): print(<char*>0)') # optional - sage.misc.cython
558+
sage: cython('def f(): print(<char*>0)') # needs sage.misc.cython
558559
sage: @fork
559560
....: def g():
560561
....: os.environ["CYSIGNALS_CRASH_NDEBUG"]="yes" # skip enhanced backtrace (it is slow)
561562
....: f()
562-
sage: print("this works"); g() # optional - sage.misc.cython
563+
sage: print("this works"); g() # needs sage.misc.cython
563564
this works...
564565
<BLANKLINE>
565566
------------------------------------------------------------------------

src/sage/parallel/map_reduce.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@
184184
185185
Compare::
186186
187-
sage: from sage.combinat.q_analogues import q_factorial # optional - sage.combinat
188-
sage: q_factorial(5) # optional - sage.combinat
187+
sage: from sage.combinat.q_analogues import q_factorial # needs sage.combinat
188+
sage: q_factorial(5) # needs sage.combinat
189189
q^10 + 4*q^9 + 9*q^8 + 15*q^7 + 20*q^6 + 22*q^5 + 20*q^4 + 15*q^3 + 9*q^2 + 4*q + 1
190190
191191
* **Listing the objects.** One can also compute the list of objects in a
@@ -1653,14 +1653,14 @@ def steal(self):
16531653
sage: EX = RESetMPExample(maxl=6)
16541654
sage: EX.setup_workers(2)
16551655
1656+
sage: # known bug (Issue #27537)
16561657
sage: w0, w1 = EX._workers
16571658
sage: w0._todo.append(42)
16581659
sage: thief0 = Thread(target = w0._thief, name="Thief")
1659-
sage: thief0.start() # known bug (Issue #27537)
1660-
1661-
sage: w1.steal() # known bug (Issue #27537)
1660+
sage: thief0.start()
1661+
sage: w1.steal()
16621662
42
1663-
sage: w0._todo # known bug (Issue #27537)
1663+
sage: w0._todo
16641664
deque([])
16651665
"""
16661666
self._mapred._signal_task_done()

src/sage/sets/recursively_enumerated_set.pyx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2088,13 +2088,20 @@ class RecursivelyEnumeratedSet_forest(Parent):
20882088
sage: F = RecursivelyEnumeratedSet(seeds, succ,
20892089
....: structure='forest', enumeration='depth')
20902090
2091+
sage: # needs sage.symbolic
20912092
sage: y = var('y')
20922093
sage: def map_function(t):
20932094
....: li, sum, _ = t
20942095
....: return y ^ sum
2095-
sage: reduce_function = lambda x,y: x + y
2096+
sage: def reduce_function(x, y):
2097+
....: return x + y
20962098
sage: F.map_reduce(map_function, reduce_function, 0)
2097-
y^45 + y^44 + y^43 + 2*y^42 + 2*y^41 + 3*y^40 + 4*y^39 + 5*y^38 + 6*y^37 + 8*y^36 + 9*y^35 + 10*y^34 + 12*y^33 + 13*y^32 + 15*y^31 + 17*y^30 + 18*y^29 + 19*y^28 + 21*y^27 + 21*y^26 + 22*y^25 + 23*y^24 + 23*y^23 + 23*y^22 + 23*y^21 + 22*y^20 + 21*y^19 + 21*y^18 + 19*y^17 + 18*y^16 + 17*y^15 + 15*y^14 + 13*y^13 + 12*y^12 + 10*y^11 + 9*y^10 + 8*y^9 + 6*y^8 + 5*y^7 + 4*y^6 + 3*y^5 + 2*y^4 + 2*y^3 + y^2 + y
2099+
y^45 + y^44 + y^43 + 2*y^42 + 2*y^41 + 3*y^40 + 4*y^39 + 5*y^38 + 6*y^37
2100+
+ 8*y^36 + 9*y^35 + 10*y^34 + 12*y^33 + 13*y^32 + 15*y^31 + 17*y^30
2101+
+ 18*y^29 + 19*y^28 + 21*y^27 + 21*y^26 + 22*y^25 + 23*y^24 + 23*y^23
2102+
+ 23*y^22 + 23*y^21 + 22*y^20 + 21*y^19 + 21*y^18 + 19*y^17 + 18*y^16
2103+
+ 17*y^15 + 15*y^14 + 13*y^13 + 12*y^12 + 10*y^11 + 9*y^10 + 8*y^9 + 6*y^8
2104+
+ 5*y^7 + 4*y^6 + 3*y^5 + 2*y^4 + 2*y^3 + y^2 + y
20982105
20992106
Here is an example with the default values::
21002107

0 commit comments

Comments
 (0)