Inheritance diagram for IPython.core.displayhook:
Displayhook for IPython.
This defines a callable class that IPython uses for sys.displayhook.
Authors:
Bases: IPython.config.configurable.Configurable
The custom IPython displayhook to replace sys.displayhook.
This class does many things, but the basic idea is that it is a callable that gets called anytime user code returns a value.
Currently this class does more than just the displayhook logic and that extra logic should eventually be moved out of here.
Check if the user has set the ‘_’ variable by hand.
Get the config class config section
Get the help string for this class in ReST format.
Get the help string for a single trait.
Get the help string for a single trait and print it.
Get a list of all the names of this classes traits.
This method is just like the trait_names() method, but is unbound.
Get a list of all the traits of this class.
This method is just like the traits() method, but is unbound.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
Compute format data of the object to be displayed.
The format data is a generalization of the repr() of an object. In the default implementation the format data is a dict of key value pair where the keys are valid MIME types and the values are JSON’able data structure containing the raw data for that MIME type. It is up to frontends to determine pick a MIME to to use and display that data in an appropriate manner.
This method only computes the format data for the object and should NOT actually print or write that to a stream.
Parameters : | result : object
|
---|---|
Returns : | format_data : dict
|
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
Finish up all displayhook activities.
Log the output.
Setup a handler to be called when a trait changes.
This is used to setup dynamic notifications of trait changes.
Static handlers can be created by creating methods on a HasTraits subclass with the naming convention ‘_[traitname]_changed’. Thus, to create static handler for the trait ‘a’, create the method _a_changed(self, name, old, new) (fewer arguments can be used, see below).
Parameters : | handler : callable
name : list, str, None
remove : bool
|
---|
Should we silence the display hook because of ‘;’?
Set the active color scheme and configure colors for the three prompt subsystems.
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
Start the displayhook, initializing resources.
Get metadata values for trait by key.
Get a list of all the names of this classes traits.
Get a list of all the traits of this class.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
Update user_ns with various things like _, __, _1, etc.
Write the format data dict to the frontend.
This default version of this method simply writes the plain text representation of the object to io.stdout. Subclasses should override this method to send the entire format_dict to the frontends.
Parameters : | format_dict : dict
|
---|
Write the output prompt.
The default implementation simply writes the prompt to io.stdout.