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

Method _render

rich/table.py:755–935  ·  view source on GitHub ↗
(
        self, console: "Console", options: "ConsoleOptions", widths: List[int]
    )

Source from the content-addressed store, hash-verified

753 return measurement
754
755 def _render(
756 self, console: "Console", options: "ConsoleOptions", widths: List[int]
757 ) -> "RenderResult":
758 table_style = console.get_style(self.style or "")
759
760 border_style = table_style + console.get_style(self.border_style or "")
761 _column_cells = (
762 self._get_cells(console, column_index, column)
763 for column_index, column in enumerate(self.columns)
764 )
765
766 row_cells: List[Tuple[_Cell, ...]] = list(zip(*_column_cells))
767 _box = (
768 self.box.substitute(
769 options, safe=pick_bool(self.safe_box, console.safe_box)
770 )
771 if self.box
772 else None
773 )
774 _box = _box.get_plain_headed_box() if _box and not self.show_header else _box
775
776 new_line = Segment.line()
777
778 columns = self.columns
779 show_header = self.show_header
780 show_footer = self.show_footer
781 show_edge = self.show_edge
782 show_lines = self.show_lines
783 leading = self.leading
784
785 _Segment = Segment
786 if _box:
787 box_segments = [
788 (
789 _Segment(_box.head_left, border_style),
790 _Segment(_box.head_right, border_style),
791 _Segment(_box.head_vertical, border_style),
792 ),
793 (
794 _Segment(_box.mid_left, border_style),
795 _Segment(_box.mid_right, border_style),
796 _Segment(_box.mid_vertical, border_style),
797 ),
798 (
799 _Segment(_box.foot_left, border_style),
800 _Segment(_box.foot_right, border_style),
801 _Segment(_box.foot_vertical, border_style),
802 ),
803 ]
804 if show_edge:
805 yield _Segment(_box.get_top(widths), border_style)
806 yield new_line
807 else:
808 box_segments = []
809
810 get_row_style = self.get_row_style
811 get_style = console.get_style
812

Callers 1

__rich_console__Method · 0.95

Calls 15

_get_cellsMethod · 0.95
pick_boolFunction · 0.85
loop_first_lastFunction · 0.85
get_styleFunction · 0.85
loop_lastFunction · 0.85
get_styleMethod · 0.80
substituteMethod · 0.80
get_plain_headed_boxMethod · 0.80
get_topMethod · 0.80
nullMethod · 0.80
render_linesMethod · 0.80
set_shapeMethod · 0.80

Tested by

no test coverage detected