kernel.core.history

Module: kernel.core.history

Inheritance diagram for IPython.kernel.core.history:

Manage the input and output history of the interpreter and the frontend.

There are 2 different history objects, one that lives in the interpreter, and one that lives in the frontend. They are synced with a diff at each execution of a command, as the interpreter history is a real stack, its existing entries are not mutable.

Classes

FrontEndHistory

class IPython.kernel.core.history.FrontEndHistory(input_cache=None, output_cache=None)

Bases: IPython.kernel.core.history.History

An object managing the input and output history at the frontend. It is used as a local cache to reduce network latency problems and multiple users editing the same thing.

__init__(input_cache=None, output_cache=None)
add_items(item_list)
Adds the given command list to the stack of executed commands.

History

class IPython.kernel.core.history.History(input_cache=None, output_cache=None)

Bases: object

An object managing the input and output history.

__init__(input_cache=None, output_cache=None)
get_history_item(index)
Returns the history string at index, where index is the distance from the end (positive).

InterpreterHistory

class IPython.kernel.core.history.InterpreterHistory(input_cache=None, output_cache=None)

Bases: IPython.kernel.core.history.History

An object managing the input and output history at the interpreter level.

__init__(input_cache=None, output_cache=None)
get_history_item(index)
Returns the history string at index, where index is the distance from the end (positive).
get_input_after(index)
Returns the list of the commands entered after index.
get_input_cache()
setup_namespace(namespace)

Add the input and output caches into the interpreter’s namespace with IPython-conventional names.

Parameters:namespace : dict
update_history(interpreter, python)

Update the history objects that this object maintains and the interpreter’s namespace.

Parameters:

interpreter : Interpreter

python : str

The real Python code that was translated and actually executed.