MCPcopy
hub / github.com/Textualize/rich / _repr_mimebundle_

Method _repr_mimebundle_

rich/jupyter.py:41–56  ·  rich/jupyter.py::JupyterMixin._repr_mimebundle_
(
        self: "ConsoleRenderable",
        include: Sequence[str],
        exclude: Sequence[str],
        **kwargs: Any,
    )

Source from the content-addressed store, hash-verified

39 __slots__ = ()
40
41 def _repr_mimebundle_(
42 self: class="st">"ConsoleRenderable",
43 include: Sequence[str],
44 exclude: Sequence[str],
45 **kwargs: Any,
46 ) -> Dict[str, str]:
47 console = get_console()
48 segments = list(console.render(self, console.options))
49 html = _render_segments(segments)
50 text = console._render_buffer(segments)
51 data = {class="st">"text/plain": text, class="st">"text/html": html}
52 if include:
53 data = {k: v for (k, v) in data.items() if k in include}
54 if exclude:
55 data = {k: v for (k, v) in data.items() if k not in exclude}
56 return data
57
58
59def _render_segments(segments: Iterable[Segment]) -> str:

Callers

nothing calls this directly

Calls 4

get_consoleFunction · 0.85
_render_segmentsFunction · 0.85
_render_bufferMethod · 0.80
renderMethod · 0.45

Tested by

no test coverage detected