{ } Raw JSON

bundles / IPython 9.17.0 / IPython / core / compilerop / CachingCompiler / cache

function

IPython.core.compilerop:CachingCompiler.cache

source: /dev/ipython/IPython/core/compilerop.py:138

Signature

def cache(self, transformed_code: str, number: int = 0, raw_code: str | None = None) → str

Summary

Make a name for a block of code, and cache the code.

Parameters

transformed_code : str

The executable Python source code to cache and compile.

number : int

A number which forms part of the code's name. Used for the execution counter.

raw_code : str

The raw code before transformation, if None, set to transformed_code.

Returns

: The name of the cached code (as a string). Pass this as the filename
: argument to compilation, so that tracebacks are correctly hooked up.

Aliases

  • IPython.core.compilerop.CachingCompiler.cache