Show More
@@ -41,7 +41,7 b' or using unicode completion:' | |||
|
41 | 41 | |
|
42 | 42 | Only valid Python identifiers will complete. Combining characters (like arrow or |
|
43 | 43 | dots) are also available, unlike latex they need to be put after the their |
|
44 | counterpart that is to say, `F\\\\vec<tab>` is correct, not `\\\\vec<tab>F`. | |
|
44 | counterpart that is to say, ``F\\\\vec<tab>`` is correct, not ``\\\\vec<tab>F``. | |
|
45 | 45 | |
|
46 | 46 | Some browsers are known to display combining characters incorrectly. |
|
47 | 47 |
@@ -199,19 +199,29 b' class ExecutionInfo(object):' | |||
|
199 | 199 | store_history = False |
|
200 | 200 | silent = False |
|
201 | 201 | shell_futures = True |
|
202 | cell_id = None | |
|
202 | 203 | |
|
203 | def __init__(self, raw_cell, store_history, silent, shell_futures): | |
|
204 | def __init__(self, raw_cell, store_history, silent, shell_futures, cell_id): | |
|
204 | 205 | self.raw_cell = raw_cell |
|
205 | 206 | self.store_history = store_history |
|
206 | 207 | self.silent = silent |
|
207 | 208 | self.shell_futures = shell_futures |
|
209 | self.cell_id = cell_id | |
|
208 | 210 | |
|
209 | 211 | def __repr__(self): |
|
210 | 212 | name = self.__class__.__qualname__ |
|
211 | raw_cell = ((self.raw_cell[:50] + '..') | |
|
212 |
|
|
|
213 | return '<%s object at %x, raw_cell="%s" store_history=%s silent=%s shell_futures=%s>' %\ | |
|
214 | (name, id(self), raw_cell, self.store_history, self.silent, self.shell_futures) | |
|
213 | raw_cell = ( | |
|
214 | (self.raw_cell[:50] + "..") if len(self.raw_cell) > 50 else self.raw_cell | |
|
215 | ) | |
|
216 | return '<%s object at %x, raw_cell="%s" store_history=%s silent=%s shell_futures=%s cell_id=%s>' % ( | |
|
217 | name, | |
|
218 | id(self), | |
|
219 | raw_cell, | |
|
220 | self.store_history, | |
|
221 | self.silent, | |
|
222 | self.shell_futures, | |
|
223 | self.cell_id, | |
|
224 | ) | |
|
215 | 225 | |
|
216 | 226 | |
|
217 | 227 | class ExecutionResult(object): |
@@ -2834,7 +2844,14 b' class InteractiveShell(SingletonConfigurable):' | |||
|
2834 | 2844 | self.showtraceback() |
|
2835 | 2845 | warn('Unknown failure executing module: <%s>' % mod_name) |
|
2836 | 2846 | |
|
2837 | def run_cell(self, raw_cell, store_history=False, silent=False, shell_futures=True): | |
|
2847 | def run_cell( | |
|
2848 | self, | |
|
2849 | raw_cell, | |
|
2850 | store_history=False, | |
|
2851 | silent=False, | |
|
2852 | shell_futures=True, | |
|
2853 | cell_id=None, | |
|
2854 | ): | |
|
2838 | 2855 | """Run a complete IPython cell. |
|
2839 | 2856 | |
|
2840 | 2857 | Parameters |
@@ -2861,14 +2878,22 b' class InteractiveShell(SingletonConfigurable):' | |||
|
2861 | 2878 | result = None |
|
2862 | 2879 | try: |
|
2863 | 2880 | result = self._run_cell( |
|
2864 |
raw_cell, store_history, silent, shell_futures |
|
|
2881 | raw_cell, store_history, silent, shell_futures, cell_id | |
|
2882 | ) | |
|
2865 | 2883 | finally: |
|
2866 | 2884 | self.events.trigger('post_execute') |
|
2867 | 2885 | if not silent: |
|
2868 | 2886 | self.events.trigger('post_run_cell', result) |
|
2869 | 2887 | return result |
|
2870 | 2888 | |
|
2871 | def _run_cell(self, raw_cell:str, store_history:bool, silent:bool, shell_futures:bool) -> ExecutionResult: | |
|
2889 | def _run_cell( | |
|
2890 | self, | |
|
2891 | raw_cell: str, | |
|
2892 | store_history: bool, | |
|
2893 | silent: bool, | |
|
2894 | shell_futures: bool, | |
|
2895 | cell_id: str, | |
|
2896 | ) -> ExecutionResult: | |
|
2872 | 2897 | """Internal method to run a complete IPython cell.""" |
|
2873 | 2898 | |
|
2874 | 2899 | # we need to avoid calling self.transform_cell multiple time on the same thing |
@@ -2888,6 +2913,7 b' class InteractiveShell(SingletonConfigurable):' | |||
|
2888 | 2913 | shell_futures=shell_futures, |
|
2889 | 2914 | transformed_cell=transformed_cell, |
|
2890 | 2915 | preprocessing_exc_tuple=preprocessing_exc_tuple, |
|
2916 | cell_id=cell_id, | |
|
2891 | 2917 | ) |
|
2892 | 2918 | |
|
2893 | 2919 | # run_cell_async is async, but may not actually need an eventloop. |
@@ -2908,7 +2934,9 b' class InteractiveShell(SingletonConfigurable):' | |||
|
2908 | 2934 | try: |
|
2909 | 2935 | return runner(coro) |
|
2910 | 2936 | except BaseException as e: |
|
2911 | info = ExecutionInfo(raw_cell, store_history, silent, shell_futures) | |
|
2937 | info = ExecutionInfo( | |
|
2938 | raw_cell, store_history, silent, shell_futures, cell_id | |
|
2939 | ) | |
|
2912 | 2940 | result = ExecutionResult(info) |
|
2913 | 2941 | result.error_in_exec = e |
|
2914 | 2942 | self.showtraceback(running_compiled_code=True) |
@@ -2964,7 +2992,8 b' class InteractiveShell(SingletonConfigurable):' | |||
|
2964 | 2992 | shell_futures=True, |
|
2965 | 2993 | *, |
|
2966 | 2994 | transformed_cell: Optional[str] = None, |
|
2967 | preprocessing_exc_tuple: Optional[Any] = None | |
|
2995 | preprocessing_exc_tuple: Optional[Any] = None, | |
|
2996 | cell_id=None, | |
|
2968 | 2997 | ) -> ExecutionResult: |
|
2969 | 2998 | """Run a complete IPython cell asynchronously. |
|
2970 | 2999 | |
@@ -2995,8 +3024,7 b' class InteractiveShell(SingletonConfigurable):' | |||
|
2995 | 3024 | |
|
2996 | 3025 | .. versionadded:: 7.0 |
|
2997 | 3026 | """ |
|
2998 | info = ExecutionInfo( | |
|
2999 | raw_cell, store_history, silent, shell_futures) | |
|
3027 | info = ExecutionInfo(raw_cell, store_history, silent, shell_futures, cell_id) | |
|
3000 | 3028 | result = ExecutionResult(info) |
|
3001 | 3029 | |
|
3002 | 3030 | if (not raw_cell) or raw_cell.isspace(): |
@@ -92,8 +92,8 b' class Audio(DisplayObject):' | |||
|
92 | 92 | |
|
93 | 93 | From a File: |
|
94 | 94 | |
|
95 |
>>> Audio(' |
|
|
96 |
>>> Audio(filename=' |
|
|
95 | >>> Audio('IPython/lib/tests/test.wav') # doctest: +SKIP | |
|
96 | >>> Audio(filename='IPython/lib/tests/test.wav') # doctest: +SKIP | |
|
97 | 97 | |
|
98 | 98 | From Bytes: |
|
99 | 99 |
General Comments 0
You need to be logged in to leave comments.
Login now