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

Method run_cell_async

IPython/core/interactiveshell.py:3285–3468  ·  view source on GitHub ↗

Run a complete IPython cell asynchronously. 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 his

(
        self,
        raw_cell: str,
        store_history=False,
        silent=False,
        shell_futures=True,
        *,
        transformed_cell: Optional[str] = None,
        preprocessing_exc_tuple: Optional[AnyType] = None,
        cell_id=None,
    )

Source from the content-addressed store, hash-verified

3283 return _should_be_async(cell)
3284
3285 async def run_cell_async(
3286 self,
3287 raw_cell: str,
3288 store_history=False,
3289 silent=False,
3290 shell_futures=True,
3291 *,
3292 transformed_cell: Optional[str] = None,
3293 preprocessing_exc_tuple: Optional[AnyType] = None,
3294 cell_id=None,
3295 ) -> ExecutionResult:
3296 """Run a complete IPython cell asynchronously.
3297
3298 Parameters
3299 ----------
3300 raw_cell : str
3301 The code (including IPython code such as %magic functions) to run.
3302 store_history : bool
3303 If True, the raw and translated cell will be stored in IPython's
3304 history. For user code calling back into IPython's machinery, this
3305 should be set to False.
3306 silent : bool
3307 If True, avoid side-effects, such as implicit displayhooks and
3308 and logging. silent=True forces store_history=False.
3309 shell_futures : bool
3310 If True, the code will share future statements with the interactive
3311 shell. It will both be affected by previous __future__ imports, and
3312 any __future__ imports in the code will affect the shell. If False,
3313 __future__ imports are not shared in either direction.
3314 transformed_cell: str
3315 cell that was passed through transformers
3316 preprocessing_exc_tuple:
3317 trace if the transformation failed.
3318
3319 Returns
3320 -------
3321 result : :class:`ExecutionResult`
3322
3323 .. versionadded:: 7.0
3324 """
3325 info = ExecutionInfo(
3326 raw_cell,
3327 store_history,
3328 silent,
3329 shell_futures,
3330 cell_id,
3331 transformed_cell=transformed_cell,
3332 )
3333 result = ExecutionResult(info)
3334
3335 if (not raw_cell) or raw_cell.isspace():
3336 self.last_execution_succeeded = True
3337 self.last_execution_result = result
3338 return result
3339
3340 if silent:
3341 store_history = False
3342

Callers 2

_run_cellMethod · 0.95
test_run_cell_asyncFunction · 0.80

Calls 15

transform_cellMethod · 0.95
showtracebackMethod · 0.95
showindentationerrorMethod · 0.95
showsyntaxerrorMethod · 0.95
transform_astMethod · 0.95
run_ast_nodesMethod · 0.95
ExecutionInfoClass · 0.85
ExecutionResultClass · 0.85
triggerMethod · 0.80
warnMethod · 0.80
store_inputsMethod · 0.80

Tested by 1

test_run_cell_asyncFunction · 0.64