Skip to content

Commit f70d751

Browse files
author
Matthias Koeppe
committed
sage.repl: Update # needs
1 parent 3f30e4d commit f70d751

File tree

4 files changed

+40
-37
lines changed

4 files changed

+40
-37
lines changed

src/sage/repl/display/fancy_repr.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,19 +181,20 @@ def __call__(self, obj, p, cycle):
181181
182182
EXAMPLES::
183183
184+
sage: # needs sage.modules
184185
sage: from sage.repl.display.fancy_repr import LargeMatrixHelpRepr
185-
sage: M = identity_matrix(40) # optional - sage.modules
186-
sage: pp = LargeMatrixHelpRepr() # optional - sage.modules
187-
sage: pp.format_string(M) # optional - sage.modules
186+
sage: M = identity_matrix(40)
187+
sage: pp = LargeMatrixHelpRepr()
188+
sage: pp.format_string(M)
188189
"40 x 40 dense matrix over Integer Ring (use the '.str()' method...)"
189-
sage: pp.format_string([M, M]) # optional - sage.modules
190+
sage: pp.format_string([M, M])
190191
'--- object not handled by representer ---'
191192
192193
Leads to::
193194
194-
sage: M # optional - sage.modules
195+
sage: M # needs sage.modules
195196
40 x 40 dense matrix over Integer Ring (use the '.str()' method...)
196-
sage: [M, M] # optional - sage.modules
197+
sage: [M, M] # needs sage.modules
197198
[40 x 40 dense matrix over Integer Ring,
198199
40 x 40 dense matrix over Integer Ring]
199200
"""
@@ -312,7 +313,7 @@ def __call__(self, obj, p, cycle):
312313
313314
sage: from sage.repl.display.fancy_repr import TallListRepr
314315
sage: format_list = TallListRepr().format_string
315-
sage: format_list([1, 2, identity_matrix(2)])
316+
sage: format_list([1, 2, identity_matrix(2)]) # needs sage.modules
316317
'[\n [1 0]\n1, 2, [0 1]\n]'
317318
318319
Check that :trac:`18743` is fixed::

src/sage/repl/ipython_kernel/widgets.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class EvalWidget(TransformWidget):
173173
sage: w = EvalToggleButtons(options=["pi", "e"], transform=lambda x: x+x)
174174
sage: w
175175
EvalToggleButtons(options=('pi', 'e'), value='pi')
176-
sage: w.get_interact_value()
176+
sage: w.get_interact_value() # needs sage.symbolic
177177
2*pi
178178
"""
179179
def get_value(self):
@@ -225,7 +225,7 @@ class TransformFloatSlider(TransformWidget, FloatSlider):
225225
sage: w = TransformFloatSlider(min=0, max=100, value=7, transform=lambda x: sqrt(x))
226226
sage: w
227227
TransformFloatSlider(value=7.0)
228-
sage: w.get_interact_value() # optional - sage.symbolic
228+
sage: w.get_interact_value() # needs sage.symbolic
229229
2.6457513110645907
230230
"""
231231
pass
@@ -310,7 +310,7 @@ class EvalText(EvalWidget, Text):
310310
sage: w = EvalText(value="pi", transform=lambda x: x^2)
311311
sage: w
312312
EvalText(value='pi')
313-
sage: w.get_interact_value()
313+
sage: w.get_interact_value() # needs sage.symbolic
314314
pi^2
315315
"""
316316
pass
@@ -327,7 +327,7 @@ class EvalTextarea(EvalWidget, Textarea):
327327
sage: w = EvalTextarea(value="pi", transform=lambda x: x^2)
328328
sage: w
329329
EvalTextarea(value='pi')
330-
sage: w.get_interact_value()
330+
sage: w.get_interact_value() # needs sage.symbolic
331331
pi^2
332332
"""
333333
pass
@@ -351,7 +351,7 @@ def get_interact_value(self):
351351
EXAMPLES::
352352
353353
sage: from sage.repl.ipython_kernel.widgets import SageColorPicker
354-
sage: SageColorPicker().get_interact_value() # optional - sage.plot
354+
sage: SageColorPicker().get_interact_value() # needs sage.plot
355355
RGB color (0.0, 0.0, 0.0)
356356
"""
357357
return Color(self.value)
@@ -395,13 +395,13 @@ def __init__(self, nrows, ncols, make_widget, description=u"", transform=None):
395395
EXAMPLES::
396396
397397
sage: from sage.repl.ipython_kernel.widgets import Grid, EvalText
398-
sage: w = Grid(2, 2, lambda i,j: EvalText(str(j+4*i)), # optional - sage.modules
398+
sage: w = Grid(2, 2, lambda i,j: EvalText(str(j+4*i)), # needs sage.modules
399399
....: description="2x2 matrix", transform=matrix); w
400400
Grid(value=[[0, 1], [4, 5]],
401401
children=(Label(value='2x2 matrix'),
402402
VBox(children=(EvalText(value='0'), EvalText(value='4'))),
403403
VBox(children=(EvalText(value='1'), EvalText(value='5')))))
404-
sage: w.get_interact_value() # optional - sage.modules
404+
sage: w.get_interact_value() # needs sage.modules
405405
[0 1]
406406
[4 5]
407407

src/sage/repl/rich_output/backend_base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ def latex_formatter(self, obj, **kwds):
459459
sage: out.html.get_str()
460460
'<html>\\(\\displaystyle \\frac{1}{2}\\)</html>'
461461
462+
sage: # needs sage.symbolic
462463
sage: out = backend.latex_formatter([1/2, x, 3/4, ZZ], concatenate=False)
463464
sage: out.html.get_str()
464465
'<html>\\(\\displaystyle \\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left[\\frac{1}{2}, x, \\frac{3}{4}, \\Bold{Z}\\right]\\)</html>'

src/sage/repl/rich_output/pretty_print.py

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
sage: pretty_print(1, 2, 3)
1313
1 2 3
1414
15-
sage: pretty_print(x^2 / (x + 1)) # optional - sage.symbolic
15+
sage: pretty_print(x^2 / (x + 1)) # needs sage.symbolic
1616
x^2/(x + 1)
1717
1818
TESTS::
@@ -23,7 +23,7 @@
2323
EXAMPLES::
2424
2525
sage: %display ascii_art # not tested
26-
sage: pretty_print(x^2 / (x + 1)) # optional - sage.symbolic
26+
sage: pretty_print(x^2 / (x + 1)) # needs sage.symbolic
2727
2
2828
x
2929
-----
@@ -41,9 +41,9 @@
4141
:func:`pretty_print` does not print anything and just shows the
4242
graphics instead::
4343
44-
sage: print(plot(sin)) # optional - sage.symbolic sage.plot
44+
sage: print(plot(sin)) # needs sage.plot sage.symbolic
4545
Graphics object consisting of 1 graphics primitive
46-
sage: pretty_print(plot(sin)) # optional - sage.symbolic sage.plot
46+
sage: pretty_print(plot(sin)) # needs sage.plot sage.symbolic
4747
"""
4848

4949
# ****************************************************************************
@@ -117,10 +117,10 @@ def _concatenate_graphs(self):
117117
EXAMPLES::
118118
119119
sage: from sage.repl.rich_output.pretty_print import SequencePrettyPrinter
120-
sage: plt = SequencePrettyPrinter(*list(graphs(3)))._concatenate_graphs() # optional - sage.graphs sage.plot
121-
sage: type(plt) # optional - sage.graphs sage.plot
120+
sage: plt = SequencePrettyPrinter(*list(graphs(3)))._concatenate_graphs() # needs sage.graphs sage.plot
121+
sage: type(plt) # needs sage.graphs sage.plot
122122
<class 'sage.plot.multigraphics.GraphicsArray'>
123-
sage: plt # optional - sage.graphs sage.plot
123+
sage: plt # needs sage.graphs sage.plot
124124
Graphics Array of size 1 x 4
125125
"""
126126
import sage.graphs.graph_list as graphs_list
@@ -137,10 +137,10 @@ def _concatenate_graphics(self):
137137
EXAMPLES::
138138
139139
sage: from sage.repl.rich_output.pretty_print import SequencePrettyPrinter
140-
sage: ga = SequencePrettyPrinter(*[Graphics()]*5)._concatenate_graphics() # optional - sage.plot
141-
sage: type(ga) # optional - sage.plot
140+
sage: ga = SequencePrettyPrinter(*[Graphics()]*5)._concatenate_graphics() # needs sage.plot
141+
sage: type(ga) # needs sage.plot
142142
<class 'sage.plot.multigraphics.GraphicsArray'>
143-
sage: ga.nrows(), ga.ncols() # optional - sage.plot
143+
sage: ga.nrows(), ga.ncols() # needs sage.plot
144144
(2, 4)
145145
"""
146146
from sage.plot.plot import graphics_array
@@ -159,9 +159,9 @@ def pretty_print(self):
159159
The keyword arguments are only used the first time graphics
160160
output is generated::
161161
162-
sage: seq = SequencePrettyPrinter(Graph(), Graph(), edge_labels=True) # optional - sage.graphs sage.plot
163-
sage: seq.pretty_print() # does not pass edge_labels to graphics object # optional - sage.graphs sage.plot
164-
sage: seq._concatenate_graphs().show(edge_labels=True) # optional - sage.graphs sage.plot
162+
sage: seq = SequencePrettyPrinter(Graph(), Graph(), edge_labels=True) # needs sage.graphs sage.plot
163+
sage: seq.pretty_print() # does not pass edge_labels to graphics object # needs sage.graphs sage.plot
164+
sage: seq._concatenate_graphs().show(edge_labels=True) # needs sage.graphs sage.plot
165165
Traceback (most recent call last):
166166
...
167167
TypeError: ...matplotlib() got an unexpected keyword argument 'edge_labels'
@@ -243,13 +243,13 @@ def pretty_print(*args, **kwds):
243243
For text-based backends, the default text display preference is to output
244244
plain text which is usually the same as using ``print()``::
245245
246-
sage: pretty_print(x^2 / (x + 1)) # optional - sage.symbolic
246+
sage: pretty_print(x^2 / (x + 1)) # needs sage.symbolic
247247
x^2/(x + 1)
248248
249-
sage: t = BinaryTrees(3).first() # optional - sage.graphs
250-
sage: pretty_print(t) # optional - sage.graphs
249+
sage: t = BinaryTrees(3).first() # needs sage.graphs
250+
sage: pretty_print(t) # needs sage.graphs
251251
[., [., [., .]]]
252-
sage: print(t) # optional - sage.graphs
252+
sage: print(t) # needs sage.graphs
253253
[., [., [., .]]]
254254
255255
TESTS::
@@ -263,7 +263,7 @@ def pretty_print(*args, **kwds):
263263
The following illustrates a possible use-case::
264264
265265
sage: %display ascii_art # not tested
266-
sage: for t in BinaryTrees(3)[:3]: # optional - sage.graphs
266+
sage: for t in BinaryTrees(3)[:3]: # needs sage.graphs
267267
....: pretty_print(t)
268268
o
269269
\
@@ -279,7 +279,7 @@ def pretty_print(*args, **kwds):
279279
/ \
280280
o o
281281
282-
sage: pretty_print(x^2 / (x + 1)) # optional - sage.symbolic
282+
sage: pretty_print(x^2 / (x + 1)) # needs sage.symbolic
283283
2
284284
x
285285
-----
@@ -293,10 +293,11 @@ def pretty_print(*args, **kwds):
293293
294294
::
295295
296-
sage: plt = plot(sin) # optional - sage.symbolic # optional - sage.plot
297-
sage: pretty_print(plt) # graphics output # optional - sage.symbolic # optional - sage.plot
298-
sage: pretty_print(plt, plt) # graphics output # optional - sage.symbolic # optional - sage.plot
299-
sage: pretty_print(ZZ, 123, plt) # optional - sage.symbolic # optional - sage.plot
296+
sage: # needs sage.plot sage.symbolic
297+
sage: plt = plot(sin)
298+
sage: pretty_print(plt) # graphics output
299+
sage: pretty_print(plt, plt) # graphics output
300+
sage: pretty_print(ZZ, 123, plt)
300301
Integer Ring 123 Graphics object consisting of 1 graphics primitive
301302
"""
302303
dm = get_display_manager()

0 commit comments

Comments
 (0)