##// END OF EJS Templates
Allow to get cellid from ipykernel...
Matthias Bussonnier -
Show More
@@ -41,7 +41,7 b' or using unicode completion:'
41
41
42 Only valid Python identifiers will complete. Combining characters (like arrow or
42 Only valid Python identifiers will complete. Combining characters (like arrow or
43 dots) are also available, unlike latex they need to be put after the their
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 Some browsers are known to display combining characters incorrectly.
46 Some browsers are known to display combining characters incorrectly.
47
47
@@ -199,19 +199,29 b' class ExecutionInfo(object):'
199 store_history = False
199 store_history = False
200 silent = False
200 silent = False
201 shell_futures = True
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 self.raw_cell = raw_cell
205 self.raw_cell = raw_cell
205 self.store_history = store_history
206 self.store_history = store_history
206 self.silent = silent
207 self.silent = silent
207 self.shell_futures = shell_futures
208 self.shell_futures = shell_futures
209 self.cell_id = cell_id
208
210
209 def __repr__(self):
211 def __repr__(self):
210 name = self.__class__.__qualname__
212 name = self.__class__.__qualname__
211 raw_cell = ((self.raw_cell[:50] + '..')
213 raw_cell = (
212 if len(self.raw_cell) > 50 else self.raw_cell)
214 (self.raw_cell[:50] + "..") if len(self.raw_cell) > 50 else self.raw_cell
213 return '<%s object at %x, raw_cell="%s" store_history=%s silent=%s shell_futures=%s>' %\
215 )
214 (name, id(self), raw_cell, self.store_history, self.silent, self.shell_futures)
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 class ExecutionResult(object):
227 class ExecutionResult(object):
@@ -2834,7 +2844,14 b' class InteractiveShell(SingletonConfigurable):'
2834 self.showtraceback()
2844 self.showtraceback()
2835 warn('Unknown failure executing module: <%s>' % mod_name)
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 """Run a complete IPython cell.
2855 """Run a complete IPython cell.
2839
2856
2840 Parameters
2857 Parameters
@@ -2861,14 +2878,22 b' class InteractiveShell(SingletonConfigurable):'
2861 result = None
2878 result = None
2862 try:
2879 try:
2863 result = self._run_cell(
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 finally:
2883 finally:
2866 self.events.trigger('post_execute')
2884 self.events.trigger('post_execute')
2867 if not silent:
2885 if not silent:
2868 self.events.trigger('post_run_cell', result)
2886 self.events.trigger('post_run_cell', result)
2869 return result
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 """Internal method to run a complete IPython cell."""
2897 """Internal method to run a complete IPython cell."""
2873
2898
2874 # we need to avoid calling self.transform_cell multiple time on the same thing
2899 # we need to avoid calling self.transform_cell multiple time on the same thing
@@ -2888,6 +2913,7 b' class InteractiveShell(SingletonConfigurable):'
2888 shell_futures=shell_futures,
2913 shell_futures=shell_futures,
2889 transformed_cell=transformed_cell,
2914 transformed_cell=transformed_cell,
2890 preprocessing_exc_tuple=preprocessing_exc_tuple,
2915 preprocessing_exc_tuple=preprocessing_exc_tuple,
2916 cell_id=cell_id,
2891 )
2917 )
2892
2918
2893 # run_cell_async is async, but may not actually need an eventloop.
2919 # run_cell_async is async, but may not actually need an eventloop.
@@ -2908,7 +2934,9 b' class InteractiveShell(SingletonConfigurable):'
2908 try:
2934 try:
2909 return runner(coro)
2935 return runner(coro)
2910 except BaseException as e:
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 result = ExecutionResult(info)
2940 result = ExecutionResult(info)
2913 result.error_in_exec = e
2941 result.error_in_exec = e
2914 self.showtraceback(running_compiled_code=True)
2942 self.showtraceback(running_compiled_code=True)
@@ -2964,7 +2992,8 b' class InteractiveShell(SingletonConfigurable):'
2964 shell_futures=True,
2992 shell_futures=True,
2965 *,
2993 *,
2966 transformed_cell: Optional[str] = None,
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 ) -> ExecutionResult:
2997 ) -> ExecutionResult:
2969 """Run a complete IPython cell asynchronously.
2998 """Run a complete IPython cell asynchronously.
2970
2999
@@ -2995,8 +3024,7 b' class InteractiveShell(SingletonConfigurable):'
2995
3024
2996 .. versionadded:: 7.0
3025 .. versionadded:: 7.0
2997 """
3026 """
2998 info = ExecutionInfo(
3027 info = ExecutionInfo(raw_cell, store_history, silent, shell_futures, cell_id)
2999 raw_cell, store_history, silent, shell_futures)
3000 result = ExecutionResult(info)
3028 result = ExecutionResult(info)
3001
3029
3002 if (not raw_cell) or raw_cell.isspace():
3030 if (not raw_cell) or raw_cell.isspace():
@@ -92,8 +92,8 b' class Audio(DisplayObject):'
92
92
93 From a File:
93 From a File:
94
94
95 >>> Audio('/path/to/sound.wav') # doctest: +SKIP
95 >>> Audio('IPython/lib/tests/test.wav') # doctest: +SKIP
96 >>> Audio(filename='/path/to/sound.ogg') # doctest: +SKIP
96 >>> Audio(filename='IPython/lib/tests/test.wav') # doctest: +SKIP
97
97
98 From Bytes:
98 From Bytes:
99
99
@@ -1,7 +1,7 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 # encoding: utf-8
2 # encoding: utf-8
3 """
3 """
4 The :class:`~IPython.core.application.Application` object for the command
4 The :class:`~traitlets.config.application.Application` object for the command
5 line :command:`ipython` program.
5 line :command:`ipython` program.
6 """
6 """
7
7
General Comments 0
You need to be logged in to leave comments. Login now