MCPcopy Index your code
hub / github.com/ipython/ipython / run_cell

Method run_cell

IPython/core/interactiveshell.py:3131–3177  ·  view source on GitHub ↗

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

(
        self,
        raw_cell,
        store_history=False,
        silent=False,
        shell_futures=True,
        cell_id=None,
    )

Source from the content-addressed store, hash-verified

3129 stream.write = original_write
3130
3131 def run_cell(
3132 self,
3133 raw_cell,
3134 store_history=False,
3135 silent=False,
3136 shell_futures=True,
3137 cell_id=None,
3138 ):
3139 """Run a complete IPython cell.
3140
3141 Parameters
3142 ----------
3143 raw_cell : str
3144 The code (including IPython code such as %magic functions) to run.
3145 store_history : bool
3146 If True, the raw and translated cell will be stored in IPython's
3147 history. For user code calling back into IPython's machinery, this
3148 should be set to False.
3149 silent : bool
3150 If True, avoid side-effects, such as implicit displayhooks and
3151 and logging. silent=True forces store_history=False.
3152 shell_futures : bool
3153 If True, the code will share future statements with the interactive
3154 shell. It will both be affected by previous __future__ imports, and
3155 any __future__ imports in the code will affect the shell. If False,
3156 __future__ imports are not shared in either direction.
3157 cell_id : str, optional
3158 A unique identifier for the cell. This is used in the messaging system
3159 to match output with execution requests and for tracking cell execution
3160 history across kernel restarts. In notebook contexts, this is typically
3161 a UUID generated by the frontend. If None, the kernel may generate an
3162 internal identifier or proceed without cell tracking capabilities.
3163 Returns
3164 -------
3165 result : :class:`ExecutionResult`
3166 """
3167 result = None
3168 with self._tee(channel="stdout"), self._tee(channel="stderr"):
3169 try:
3170 result = self._run_cell(
3171 raw_cell, store_history, silent, shell_futures, cell_id
3172 )
3173 finally:
3174 self.events.trigger("post_execute")
3175 if not silent:
3176 self.events.trigger("post_run_cell", result)
3177 return result
3178
3179 def _run_cell(
3180 self,

Callers 6

safe_execfile_ipyMethod · 0.95
_run_exec_linesMethod · 0.45
_run_cmd_line_codeMethod · 0.45
captureMethod · 0.45
rerunMethod · 0.45
editMethod · 0.45

Calls 3

_teeMethod · 0.95
_run_cellMethod · 0.95
triggerMethod · 0.80

Tested by

no test coverage detected