MCPcopy Create free account
hub / github.com/ipython/ipython / format_mime

Method format_mime

IPython/core/oinspect.py:553–567  ·  view source on GitHub ↗
(self, bundle)

Source from the content-addressed store, hash-verified

551
552
553 def format_mime(self, bundle):
554
555 text_plain = bundle['text/plain']
556
557 text = ''
558 heads, bodies = list(zip(*text_plain))
559 _len = max(len(h) for h in heads)
560
561 for head, body in zip(heads, bodies):
562 body = body.strip('\n')
563 delim = '\n' if '\n' in body else ' '
564 text += self.__head(head+':') + (_len - len(head))*' ' +delim + body +'\n'
565
566 bundle['text/plain'] = text
567 return bundle
568
569 def _get_info(self, obj, oname='', formatter=None, info=None, detail_level=0):
570 """Retrieve an info dict and format it.

Callers 1

_get_infoMethod · 0.95

Calls 1

__headMethod · 0.95

Tested by

no test coverage detected