bundles / IPython 9.5.0 / IPython / core / formatters / DisplayFormatter / format
function
IPython.core.formatters:DisplayFormatter.format
source: /IPython/core/formatters.py :149
Signature
def format ( self , obj , include = None , exclude = None ) Summary
Return a format data dict for an object.
Extended Summary
By default all format types will be computed.
The following MIME types are usually implemented:
text/plain
text/html
text/markdown
text/latex
application/json
application/javascript
application/pdf
image/png
image/jpeg
image/svg+xml
Parameters
obj: objectThe Python object whose format data will be computed.
include: list, tuple or set; optionalA 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; optionalA 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 dictsformat_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.
Notes
If an object implement
_repr_mimebundle_as well as various_repr_*_, the data returned by_repr_mimebundle_will take precedence and the corresponding_repr_*_for this mimetype will not be called.
Aliases
-
IPython.core.formatters.DisplayFormatter.format