Run a complete IPython cell. Parameters ---------- raw_cell : str The code (including IPython code such as %magic functions) to run. store_history : bool If True, the raw and translated cell will be stored in IPython's history. For user
(self, raw_cell, store_history=False, silent=False, shell_futures=True)
| 2848 | warn('Unknown failure executing module: <%s>' % mod_name) |
| 2849 | |
| 2850 | def run_cell(self, raw_cell, store_history=False, silent=False, shell_futures=True): |
| 2851 | """Run a complete IPython cell. |
| 2852 | |
| 2853 | Parameters |
| 2854 | ---------- |
| 2855 | raw_cell : str |
| 2856 | The code (including IPython code such as %magic functions) to run. |
| 2857 | store_history : bool |
| 2858 | If True, the raw and translated cell will be stored in IPython's |
| 2859 | history. For user code calling back into IPython's machinery, this |
| 2860 | should be set to False. |
| 2861 | silent : bool |
| 2862 | If True, avoid side-effects, such as implicit displayhooks and |
| 2863 | and logging. silent=True forces store_history=False. |
| 2864 | shell_futures : bool |
| 2865 | If True, the code will share future statements with the interactive |
| 2866 | shell. It will both be affected by previous __future__ imports, and |
| 2867 | any __future__ imports in the code will affect the shell. If False, |
| 2868 | __future__ imports are not shared in either direction. |
| 2869 | |
| 2870 | Returns |
| 2871 | ------- |
| 2872 | result : :class:`ExecutionResult` |
| 2873 | """ |
| 2874 | result = None |
| 2875 | try: |
| 2876 | result = self._run_cell( |
| 2877 | raw_cell, store_history, silent, shell_futures) |
| 2878 | finally: |
| 2879 | self.events.trigger('post_execute') |
| 2880 | if not silent: |
| 2881 | self.events.trigger('post_run_cell', result) |
| 2882 | return result |
| 2883 | |
| 2884 | def _run_cell(self, raw_cell:str, store_history:bool, silent:bool, shell_futures:bool): |
| 2885 | """Internal method to run a complete IPython cell.""" |