IPython 8.4.0 Pypi GitHub Homepage
Other Docs
NotesParametersReturns
format(self, obj, include=None, exclude=None)

By default all format types will be computed.

The following MIME types are usually implemented:

Notes

If an object implement :None:None:`_repr_mimebundle_` as well as various :None:None:`_repr_*_`, the data returned by :None:None:`_repr_mimebundle_` will take precedence and the corresponding :None:None:`_repr_*_` for this mimetype will not be called.

Parameters

obj : object

The Python object whose format data will be computed.

include : list, tuple or set; optional

A list of format type strings (MIME types) to include in the format data dict. If this is set only the format types included in this list will be computed.

exclude : list, tuple or set; optional

A list of format type string (MIME types) to exclude in the format data dict. If this is set all format types will be computed, except for those included in this argument. Mimetypes present in exclude will take precedence over the ones in include

Returns

(format_dict, metadata_dict) : tuple of two dicts

format_dict is a dictionary of key/value pairs, one of each format that was generated for the object. The keys are the format types, which will usually be MIME type strings and the values and JSON'able data structure containing the raw data for the representation in that format.

metadata_dict is a dictionary of metadata about each mime-type output. Its keys will be a strict subset of the keys in format_dict.

Return a format data dict for an object.

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /IPython/core/formatters.py#89
type: <class 'function'>
Commit: