Return a format data dict for an object. By default all format types will be computed. Parameters ---------- obj : object The Python object whose format data will be computed. Returns ------- format_dict : dict A dictionary of key/value pairs, one or ea
(obj, include=None, exclude=None)
| 989 | |
| 990 | |
| 991 | def format_display_data(obj, include=None, exclude=None): |
| 992 | """Return a format data dict for an object. |
| 993 | |
| 994 | By default all format types will be computed. |
| 995 | |
| 996 | Parameters |
| 997 | ---------- |
| 998 | obj : object |
| 999 | The Python object whose format data will be computed. |
| 1000 | |
| 1001 | Returns |
| 1002 | ------- |
| 1003 | format_dict : dict |
| 1004 | A dictionary of key/value pairs, one or each format that was |
| 1005 | generated for the object. The keys are the format types, which |
| 1006 | will usually be MIME type strings and the values and JSON'able |
| 1007 | data structure containing the raw data for the representation in |
| 1008 | that format. |
| 1009 | include : list or tuple, optional |
| 1010 | A list of format type strings (MIME types) to include in the |
| 1011 | format data dict. If this is set *only* the format types included |
| 1012 | in this list will be computed. |
| 1013 | exclude : list or tuple, optional |
| 1014 | A list of format type string (MIME types) to exclude in the format |
| 1015 | data dict. If this is set all format types will be computed, |
| 1016 | except for those included in this argument. |
| 1017 | """ |
| 1018 | from .interactiveshell import InteractiveShell |
| 1019 | |
| 1020 | return InteractiveShell.instance().display_formatter.format( |
| 1021 | obj, |
| 1022 | include, |
| 1023 | exclude |
| 1024 | ) |