Show More
@@ -35,7 +35,7 b' from IPython.utils.py3compat import string_types' | |||||
35 | #----------------------------------------------------------------------------- |
|
35 | #----------------------------------------------------------------------------- | |
36 |
|
36 | |||
37 | def _safe_exists(path): |
|
37 | def _safe_exists(path): | |
38 |
""" |
|
38 | """Check path, but don't let exceptions raise""" | |
39 | try: |
|
39 | try: | |
40 | return os.path.exists(path) |
|
40 | return os.path.exists(path) | |
41 | except Exception: |
|
41 | except Exception: | |
@@ -60,7 +60,7 b' def display(*objs, **kwargs):' | |||||
60 | format data dict. If this is set *only* the format types included |
|
60 | format data dict. If this is set *only* the format types included | |
61 | in this list will be computed. |
|
61 | in this list will be computed. | |
62 | exclude : list or tuple, optional |
|
62 | exclude : list or tuple, optional | |
63 | A list of format type string (MIME types) to exclue in the format |
|
63 | A list of format type strings (MIME types) to exclude in the format | |
64 | data dict. If this is set all format types will be computed, |
|
64 | data dict. If this is set all format types will be computed, | |
65 | except for those included in this argument. |
|
65 | except for those included in this argument. | |
66 | """ |
|
66 | """ | |
@@ -199,7 +199,7 b' def display_latex(*objs, **kwargs):' | |||||
199 |
|
199 | |||
200 | def display_json(*objs, **kwargs): |
|
200 | def display_json(*objs, **kwargs): | |
201 | """Display the JSON representation of an object. |
|
201 | """Display the JSON representation of an object. | |
202 |
|
202 | |||
203 | Note that not many frontends support displaying JSON. |
|
203 | Note that not many frontends support displaying JSON. | |
204 |
|
204 | |||
205 | Parameters |
|
205 | Parameters | |
@@ -276,11 +276,11 b' class DisplayObject(object):' | |||||
276 | url = None |
|
276 | url = None | |
277 | filename = data |
|
277 | filename = data | |
278 | data = None |
|
278 | data = None | |
279 |
|
279 | |||
280 | self.data = data |
|
280 | self.data = data | |
281 | self.url = url |
|
281 | self.url = url | |
282 | self.filename = None if filename is None else unicode(filename) |
|
282 | self.filename = None if filename is None else unicode(filename) | |
283 |
|
283 | |||
284 | self.reload() |
|
284 | self.reload() | |
285 |
|
285 | |||
286 | def reload(self): |
|
286 | def reload(self): | |
@@ -332,15 +332,15 b' class Latex(DisplayObject):' | |||||
332 |
|
332 | |||
333 |
|
333 | |||
334 | class SVG(DisplayObject): |
|
334 | class SVG(DisplayObject): | |
335 |
|
335 | |||
336 | # wrap data in a property, which extracts the <svg> tag, discarding |
|
336 | # wrap data in a property, which extracts the <svg> tag, discarding | |
337 | # document headers |
|
337 | # document headers | |
338 | _data = None |
|
338 | _data = None | |
339 |
|
339 | |||
340 | @property |
|
340 | @property | |
341 | def data(self): |
|
341 | def data(self): | |
342 | return self._data |
|
342 | return self._data | |
343 |
|
343 | |||
344 | @data.setter |
|
344 | @data.setter | |
345 | def data(self, svg): |
|
345 | def data(self, svg): | |
346 | if svg is None: |
|
346 | if svg is None: | |
@@ -358,7 +358,7 b' class SVG(DisplayObject):' | |||||
358 | # but this is probably an error. |
|
358 | # but this is probably an error. | |
359 | pass |
|
359 | pass | |
360 | self._data = svg |
|
360 | self._data = svg | |
361 |
|
361 | |||
362 | def _repr_svg_(self): |
|
362 | def _repr_svg_(self): | |
363 | return self.data |
|
363 | return self.data | |
364 |
|
364 | |||
@@ -388,8 +388,8 b' class Javascript(DisplayObject):' | |||||
388 | When this object is returned by an expression or passed to the |
|
388 | When this object is returned by an expression or passed to the | |
389 | display function, it will result in the data being displayed |
|
389 | display function, it will result in the data being displayed | |
390 | in the frontend. If the data is a URL, the data will first be |
|
390 | in the frontend. If the data is a URL, the data will first be | |
391 |
downloaded and then displayed. |
|
391 | downloaded and then displayed. | |
392 |
|
392 | |||
393 | In the Notebook, the containing element will be available as `element`, |
|
393 | In the Notebook, the containing element will be available as `element`, | |
394 | and jQuery will be available. The output area starts hidden, so if |
|
394 | and jQuery will be available. The output area starts hidden, so if | |
395 | the js appends content to `element` that should be visible, then |
|
395 | the js appends content to `element` that should be visible, then | |
@@ -410,7 +410,7 b' class Javascript(DisplayObject):' | |||||
410 | string. |
|
410 | string. | |
411 | css: : list or str |
|
411 | css: : list or str | |
412 | A sequence of css files to load before running the source code. |
|
412 | A sequence of css files to load before running the source code. | |
413 | The full URLs of the css files should be give. A single css URL |
|
413 | The full URLs of the css files should be given. A single css URL | |
414 | can also be given as a string. |
|
414 | can also be given as a string. | |
415 | """ |
|
415 | """ | |
416 | if isinstance(lib, basestring): |
|
416 | if isinstance(lib, basestring): | |
@@ -554,12 +554,12 b' class Image(DisplayObject):' | |||||
554 |
|
554 | |||
555 | def clear_output(stdout=True, stderr=True, other=True): |
|
555 | def clear_output(stdout=True, stderr=True, other=True): | |
556 | """Clear the output of the current cell receiving output. |
|
556 | """Clear the output of the current cell receiving output. | |
557 |
|
557 | |||
558 | Optionally, each of stdout/stderr or other non-stream data (e.g. anything |
|
558 | Optionally, each of stdout/stderr or other non-stream data (e.g. anything | |
559 | produced by display()) can be excluded from the clear event. |
|
559 | produced by display()) can be excluded from the clear event. | |
560 |
|
560 | |||
561 | By default, everything is cleared. |
|
561 | By default, everything is cleared. | |
562 |
|
562 | |||
563 | Parameters |
|
563 | Parameters | |
564 | ---------- |
|
564 | ---------- | |
565 | stdout : bool [default: True] |
|
565 | stdout : bool [default: True] | |
@@ -583,4 +583,4 b' def clear_output(stdout=True, stderr=True, other=True):' | |||||
583 | if stderr: |
|
583 | if stderr: | |
584 | print('\033[2K\r', file=io.stderr, end='') |
|
584 | print('\033[2K\r', file=io.stderr, end='') | |
585 | io.stderr.flush() |
|
585 | io.stderr.flush() | |
586 |
|
586 |
General Comments 0
You need to be logged in to leave comments.
Login now