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

Method _render_buffer

rich/console.py:2132–2154  ·  view source on GitHub ↗

Render buffered output, and clear buffer.

(self, buffer: Iterable[Segment])

Source from the content-addressed store, hash-verified

2130 del self._buffer[:]
2131
2132 def _render_buffer(self, buffer: Iterable[Segment]) -> str:
2133 """Render buffered output, and clear buffer."""
2134 output: List[str] = []
2135 append = output.append
2136 color_system = self._color_system
2137 legacy_windows = self.legacy_windows
2138 not_terminal = not self.is_terminal
2139 if self.no_color and color_system:
2140 buffer = Segment.remove_color(buffer)
2141 for text, style, control in buffer:
2142 if style:
2143 append(
2144 style.render(
2145 text,
2146 color_system=color_system,
2147 legacy_windows=legacy_windows,
2148 )
2149 )
2150 elif not (not_terminal and control):
2151 append(text)
2152
2153 rendered = "".join(output)
2154 return rendered
2155
2156 def input(
2157 self,

Callers 4

end_captureMethod · 0.95
_write_bufferMethod · 0.95
_repr_mimebundle_Method · 0.80
__exit__Method · 0.80

Calls 3

remove_colorMethod · 0.80
joinMethod · 0.80
renderMethod · 0.45

Tested by

no test coverage detected