frontend.prefilterfrontend

Module: frontend.prefilterfrontend

Inheritance diagram for IPython.frontend.prefilterfrontend:

Frontend class that uses IPython0 to prefilter the inputs.

Using the IPython0 mechanism gives us access to the magics.

This is a transitory class, used here to do the transition between ipython0 and ipython1. This class is meant to be short-lived as more functionnality is abstracted out of ipython0 in reusable functions and is added on the interpreter. This class can be a used to guide this refactoring.

PrefilterFrontEnd

class IPython.frontend.prefilterfrontend.PrefilterFrontEnd(ipython0=None, argv=None, *args, **kwargs)

Bases: IPython.frontend.linefrontendbase.LineFrontEndBase

Class that uses ipython0 to do prefilter the input, do the completion and the magics.

The core trick is to use an ipython0 instance to prefilter the input, and share the namespace between the interpreter instance used to execute the statements and the ipython0 used for code completion...

__init__(ipython0=None, argv=None, *args, **kwargs)
Parameters:

ipython0: an optional ipython0 instance to use for command :

prefiltering and completion. :

argv : list, optional

Used as the instance’s argv value. If not given, [] is used.

capture_output()
Capture all the output mechanisms we can think of.
complete(line)
do_exit()
Exit the shell, cleanup and save the history.
execute(python_string, raw_string=None)
prefilter_input(input_string)
Using IPython0 to prefilter the commands to turn them in executable statements that are valid Python strings.
release_output()
Release all the different captures we have made.
save_output_hooks()

Store all the output hooks we can think of, to be able to restore them.

We need to do this early, as starting the ipython0 instance will screw ouput hooks.

show_traceback()
Use ipython0 to capture the last traceback and display it.
system_call(command_string)
Allows for frontend to define their own system call, to be able capture output and redirect input.
IPython.frontend.prefilterfrontend.mk_system_call(system_call_function, command)
given a os.system replacement, and a leading string command, returns a function that will execute the command with the given argument string.