resolved RESOLVED PASS · 17 tool calls · 295 s · Textualize/rich
fix table rendering order of box elements
## Type of changes
- [x] Bug fix
- [ ] New feature
- [ ] Documentation / docstrings
- [x] Tests
- [ ] Other
## Checklist
- [x] I've run the latest [black](https://github.com/psf/black) with default args on new code.
- [x] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
- [x] I've added tests for new code.
- [x] I accept that @willmcgugan may be pedantic in the code review.
## Description
* Previously "mid" box elements appeared in last line of table (footer), while "footer" box elements appeared mid table body. Reversed that order so mid is truly mid, footer is truly footer.
* Tested with:
```
table.box.head_left = '1'
table.box.head_vertical = '2'
table.box.head_right = '3'
table.box.mid_left = '4'
table.box.mid_vertical = '5'
table.box.mid_right = '6'
table.box.foot_left = '7'
table.box.foot_vertical = '8'
table.box.foot_right = '9'
```
After change, correct ordering:
```
+--------------------------------------------------------------------------+
1Date 2Title 2 Production2 Box Office3
|------------ --------------------------------- ------------ --------------|
4Dec 20, 20195Star Wars: The Rise of Skywalker 5$275,000,0005 $375,126,1186
4May 25, 20185Solo: A Star Wars Story 5$275,000,0005 $393,151,3476
7Dec 15, 20178Star Wars Ep. VIII: The Last Jedi8$262,000,0008$1,332,539,8899
+--------------------------------------------------------------------------+
```
* All non-skipped prior automated tests pass. No automated tests added. Unclear that additional test for box ordering would add proportionate value.
| # | Tool | Arguments | Result |
|---|---|---|---|
| 1 | run_command | {
"command": "grep -rn \"box\" --include=*.py rich | grep \"table\" | head -20"
} | {"status": "ok", "stdout": "rich/table.py:14:from . import box, errors\nrich/table.py:47: box (box.Box, optional): One of the constants in box.py used to draw tfull{"status": "ok", "stdout": "rich/table.py:14:from . import box, errors\nrich/table.py:47: box (box.Box, optional): One of the constants in box.py used to draw the edges (see :ref:`appendix_box`), or ``None`` for no box lines. Defaults to box.HEAVY_HEAD.\nrich/table.py:48: safe_box (Optional[bool], optional): Disable box characters that don't display on windows legacy terminal with *raster* fonts. Defaults to True.\nrich/table.py:55: show_edge (bool, optional): Draw a box around the outside of the table. Defaults to True.\nrich/table.py:160: box (box.Box, optional): One of the constants in box.py used to draw the edges (see :ref:`appendix_box`), or ``None`` for no box lines. Defaults to box.HEAVY_HEAD.\nrich/table.py:161: safe_box (Optional[bool], optional): Disable box characters that don't display on windows legacy terminal with *raster* fonts. Defaults to True.\nrich/table.py:168: show_edge (bool, optional): Draw a box around the outside of the table. Defaults to True.\nrich/table.py:193: box: Optional[box.Box] = box.HEAVY_HEAD,\nrich/table.py:194: safe_box: Optional[bool] = None,\nrich/table.py:221: self.box = box\nrich/table.py:222: self.safe_box = safe_box\nrich/table.py:273: box=None,\nrich/table.py:297: if self.box and self.show_edge:\nrich/table.py:299: if self.box:\nrich/table.py:752: _box = (\nrich/table.py:753: self.box.substitute(\nrich/table.py:754: options, safe=pick_bool(self.safe_box, console.safe_box)\nrich/table.py:756: if self.box\nrich/table.py:759: _box = _box.get_plain_headed_box() if _box and not self.show_header else _box\nrich/table.py:771: if _box:\n", "stderr": "", "exit_code": 0} |
| 2 | run_command | {
"command": "grep -n \"box\" rich/table.py | grep -C 5 \"render\" | head -20"
} | {"status": "ok", "stdout": "", "stderr": "", "exit_code": 0}full{"status": "ok", "stdout": "", "stderr": "", "exit_code": 0} |
| 3 | run_command | {
"command": "grep -n \"box\" rich/table.py | grep -C 5 \"render\" | tail -20"
} | {"status": "ok", "stdout": "", "stderr": "", "exit_code": 0}full{"status": "ok", "stdout": "", "stderr": "", "exit_code": 0} |
| 4 | run_command | {
"command": "grep -n \"box\" rich/table.py | grep -C 2 \"foot\" | head -20"
} | {"status": "ok", "stdout": "775: _Segment(_box.head_right, border_style),\n776: _Segment(_box.head_vertical, border_style),\n779: _Segment(_box.foot_left, bordefull{"status": "ok", "stdout": "775: _Segment(_box.head_right, border_style),\n776: _Segment(_box.head_vertical, border_style),\n779: _Segment(_box.foot_left, border_style),\n780: _Segment(_box.foot_right, border_style),\n781: _Segment(_box.foot_vertical, border_style),\n784: _Segment(_box.mid_left, border_style),\n785: _Segment(_box.mid_right, border_style),\n--\n793: box_segments = []\n863: if _box:\n866: _box.get_row(widths, \"foot\", edge=show_edge), border_style\n869: left, right, _divider = box_segments[0 if first else (2 if last else 1)]\n894: if _box and first and show_header:\n", "stderr": "", "exit_code": 0} |
| 5 | run_command | {
"command": "sed -n '750,800p' rich/table.py"
} | {"status": "ok", "stdout": " )\n row_cells: List[Tuple[_Cell, ...]] = list(zip(*_column_cells))\n _box = (\n self.box.substitute(\n options, safe=pick_bool(selffull{"status": "ok", "stdout": " )\n row_cells: List[Tuple[_Cell, ...]] = list(zip(*_column_cells))\n _box = (\n self.box.substitute(\n options, safe=pick_bool(self.safe_box, console.safe_box)\n )\n if self.box\n else None\n )\n _box = _box.get_plain_headed_box() if _box and not self.show_header else _box\n\n new_line = Segment.line()\n\n columns = self.columns\n show_header = self.show_header\n show_footer = self.show_footer\n show_edge = self.show_edge\n show_lines = self.show_lines\n leading = self.leading\n\n _Segment = Segment\n if _box:\n box_segments = [\n (\n _Segment(_box.head_left, border_style),\n _Segment(_box.head_right, border_style),\n _Segment(_box.head_vertical, border_style),\n ),\n (\n _Segment(_box.foot_left, border_style),\n _Segment(_box.foot_right, border_style),\n _Segment(_box.foot_vertical, border_style),\n ),\n (\n _Segment(_box.mid_left, border_style),\n _Segment(_box.mid_right, border_style),\n _Segment(_box.mid_vertical, border_style),\n ),\n ]\n if show_edge:\n yield _Segment(_box.get_top(widths), border_style)\n yield new_line\n else:\n box_segments = []\n\n get_row_style = self.get_row_style\n get_style = console.get_style\n\n for index, (first, last, row_cell) in enumerate(loop_first_last(row_cells)):\n header_row = first and show_header\n footer_row = last and show_footer\n", "stderr": "", "exit_code": 0} |
| 6 | run_command | {
"command": "sed -n '770,870p' rich/table.py"
} | {"status": "ok", "stdout": " _Segment = Segment\n if _box:\n box_segments = [\n (\n _Segment(_box.head_left, border_style),\n _Segment(_box.head_right, border_sfull{"status": "ok", "stdout": " _Segment = Segment\n if _box:\n box_segments = [\n (\n _Segment(_box.head_left, border_style),\n _Segment(_box.head_right, border_style),\n _Segment(_box.head_vertical, border_style),\n ),\n (\n _Segment(_box.foot_left, border_style),\n _Segment(_box.foot_right, border_style),\n _Segment(_box.foot_vertical, border_style),\n ),\n (\n _Segment(_box.mid_left, border_style),\n _Segment(_box.mid_right, border_style),\n _Segment(_box.mid_vertical, border_style),\n ),\n ]\n if show_edge:\n yield _Segment(_box.get_top(widths), border_style)\n yield new_line\n else:\n box_segments = []\n\n get_row_style = self.get_row_style\n get_style = console.get_style\n\n for index, (first, last, row_cell) in enumerate(loop_first_last(row_cells)):\n header_row = first and show_header\n footer_row = last and show_footer\n row = (\n self.rows[index - show_header]\n if (not header_row and not footer_row)\n else None\n )\n max_height = 1\n cells: List[List[List[Segment]]] = []\n if header_row or footer_row:\n row_style = Style.null()\n else:\n row_style = get_style(\n get_row_style(console, index - 1 if show_header else index)\n )\n for width, cell, column in zip(widths, row_cell, columns):\n render_options = options.update(\n width=width,\n justify=column.justify,\n no_wrap=column.no_wrap,\n overflo |
| 7 | run_command | {
"command": "sed -n '860,880p' rich/table.py"
} | {"status": "ok", "stdout": " for width, _cell, cell, column in zip(widths, row_cell, cells, columns)\n ]\n\n if _box:\n if last and show_footer:\n yield _Segmenfull{"status": "ok", "stdout": " for width, _cell, cell, column in zip(widths, row_cell, cells, columns)\n ]\n\n if _box:\n if last and show_footer:\n yield _Segment(\n _box.get_row(widths, \"foot\", edge=show_edge), border_style\n )\n yield new_line\n left, right, _divider = box_segments[0 if first else (2 if last else 1)]\n\n # If the column divider is whitespace also style it with the row background\n divider = (\n _divider\n if _divider.text.strip()\n else _Segment(\n _divider.text, row_style.background_style + _divider.style\n )\n )\n for line_no in range(max_height):\n if show_edge:\n", "stderr": "", "exit_code": 0} |
| 8 | run_command | {
"command": "cat <<EOF > /tmp/test_box_order.py\nfrom rich.console import Console\nfrom rich.table import Table\nfrom rich import box\n\nconsole = Console(force_terminal=True)\n\nclass CustomBox(box.Box):\n def __init__(self):\n self.head_left = '1'\n self.head_vertical = '2'\n self.head_right = '3'\n self.mid_left = '4'\n self.mid_vertical = '5'\n self.mid_right = '6'\n self.foot_left = '7'\n self.foot_vertical = '8'\n self.foot_right = '9'\n self.top = 'TOP'\n self.bottom = 'BOTTOM'\n\nmy_box = CustomBox()\ntable = Table(box=my_box, show_header=True, show_footer=True)\ntable.add_column(\"Date\")\ntable.add_column(\"Title\")\ntable.add_column(\"Production\")\ntable.add_column(\"Box Office\")\n\ntable.add_row(\"Dec 20, 2019\", \"Star Wars: The Rise of Skywalker\", \"$275,000,000\", \"$375,126,118\")\ntable.add_row(\"May 25, 2018\", \"Solo: A Star Wars Story\", \"$275,000,000\", \"$393,151,347\")\ntable.add_row(\"Dec 15, 2017\", \"Star Wars Ep. VIII: The Last Jedi\", \"$262,000,000\", \"$1,332,539,889\")\n\n# To trigger footer, we need to add a footer row. \n# In rich.Table, footer is handled differently. \n# Let's see how to add a footer.\ntable.add_section() # This doesn't add a footer.\n# Actually, Table has a show_footer but it's for the footer row.\n# Let's just use a simple table and see the output.\n\nwith console.capture() as capture:\n console.print(table)\n\nprint(capture.text)\nEOF\npython3 /tmp/test_box_order.py\n"
} | {"status": "error", "error_type": "CommandError", "error_message": "Traceback (most recent call last):\n File \"/tmp/test_box_order.py\", line 40, in <module>\nfull{"status": "error", "error_type": "CommandError", "error_message": "Traceback (most recent call last):\n File \"/tmp/test_box_order.py\", line 40, in <module>\n console.print(table)\n ~~~~~~~~~~~~~^^^^^^^\n File \"/workspace/rich/console.py\", line 1699, in print\n extend(render(renderable, render_options))\n ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/workspace/rich/console.py\", line 1331, in render\n for render_output in iter_render:\n ^^^^^^^^^^^\n File \"/workspace/rich/table.py\", line 509, in __rich_console__\n yield from self._render(console, render_options, widths)\n File \"/workspace/rich/table.py\", line 790, in _render\n yield _Segment(_box.get_top(widths), border_style)\n ~~~~~~~~~~~~^^^^^^^^\n File \"/workspace/rich/box.py\", line 113, in get_top\n append(self.top_left)\n ^^^^^^^^^^^^^\nAttributeError: 'CustomBox' object has no attribute 'top_left'. Did you mean: 'foot_left'?\n", "details": {"stdout": "", "stderr": "Traceback (most recent call last):\n File \"/tmp/test_box_order.py\", line 40, in <module>\n console.print(table)\n ~~~~~~~~~~~~~^^^^^^^\n File \"/workspace/rich/console.py\", line 1699, in print\n extend(render(renderable, render_options))\n ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/workspace/rich/console.py\", line 1331, in render\n for render_output in iter_render:\n ^^^^^^^^^^^\n File \"/workspace/rich/table.py\", line 509, in __rich_console__\n yield from self._render(console, render_options, widths)\n File \"/workspace/rich/table.py\", line 790, in _render\n yield _Segment(_box.get_top(widths), border_style)\n ~~~~~~~~~~~~^^^^^^^^\n File \"/workspace/rich/box.py\", line 113, in get_top\n append(self.top_left)\n ^^^^^^^^^^^^^\nAttributeError: 'CustomBox' object has no attribute 'top_left'. Did you mean: 'foot_left'?\n", "exit_code": 1}} |
| 9 | run_command | {
"command": "cat rich/box.py"
} | {"status": "ok", "stdout": "import sys\nfrom typing import TYPE_CHECKING, Iterable, List\n\nif sys.version_info >= (3, 8):\n from typing import Literal\nelse:\nfull{"status": "ok", "stdout": "import sys\nfrom typing import TYPE_CHECKING, Iterable, List\n\nif sys.version_info >= (3, 8):\n from typing import Literal\nelse:\n from typing_extensions import Literal # pragma: no cover\n\n\nfrom ._loop import loop_last\n\nif TYPE_CHECKING:\n from rich.console import ConsoleOptions\n\n\nclass Box:\n \"\"\"Defines characters to render boxes.\n\n \u250c\u2500\u252c\u2510 top\n \u2502 \u2502\u2502 head\n \u251c\u2500\u253c\u2524 head_row\n \u2502 \u2502\u2502 mid\n \u251c\u2500\u253c\u2524 row\n \u251c\u2500\u253c\u2524 foot_row\n \u2502 \u2502\u2502 foot\n \u2514\u2500\u2534\u2518 bottom\n\n Args:\n box (str): Characters making up box.\n ascii (bool, optional): True if this box uses ascii characters only. Default is False.\n \"\"\"\n\n def __init__(self, box: str, *, ascii: bool = False) -> None:\n self._box = box\n self.ascii = ascii\n line1, line2, line3, line4, line5, line6, line7, line8 = box.splitlines()\n # top\n self.top_left, self.top, self.top_divider, self.top_right = iter(line1)\n # head\n self.head_left, _, self.head_vertical, self.head_right = iter(line2)\n # head_row\n (\n self.head_row_left,\n self.head_row_horizontal,\n self.head_row_cross,\n self.head_row_right,\n ) = iter(line3)\n\n # mid\n self.mid_left, _, self.mid_vertical, self.mid_right = iter(line4)\n # row\n self.row_left, self.row_horizontal, self.row_cross, self.row_right = iter(line5)\n # foot_row\n (\n self.foot_row_left,\n self.foot_row_horizontal,\n self.foot_row_cross,\n self.foot_row_right,\n ) = iter(line6)\n # foot\n self.foot_left, _, self.foot_vertical, self.foot_right = iter(line7)\n # bottom\n self.bottom_left, self.bottom, self.bottom_divider, self.bottom_ri |
| 10 | run_command | {
"command": "sed -n '770,790p' rich/table.py"
} | {"status": "ok", "stdout": " _Segment = Segment\n if _box:\n box_segments = [\n (\n _Segment(_box.head_left, border_style),\n _Segment(_box.head_right, border_sfull{"status": "ok", "stdout": " _Segment = Segment\n if _box:\n box_segments = [\n (\n _Segment(_box.head_left, border_style),\n _Segment(_box.head_right, border_style),\n _Segment(_box.head_vertical, border_style),\n ),\n (\n _Segment(_box.foot_left, border_style),\n _Segment(_box.foot_right, border_style),\n _Segment(_box.foot_vertical, border_style),\n ),\n (\n _Segment(_box.mid_left, border_style),\n _Segment(_box.mid_right, border_style),\n _Segment(_box.mid_vertical, border_style),\n ),\n ]\n if show_edge:\n yield _Segment(_box.get_top(widths), border_style)\n", "stderr": "", "exit_code": 0} |
| 11 | run_command | {
"command": "sed -n '860,875p' rich/table.py"
} | {"status": "ok", "stdout": " for width, _cell, cell, column in zip(widths, row_cell, cells, columns)\n ]\n\n if _box:\n if last and show_footer:\n yield _Segmenfull{"status": "ok", "stdout": " for width, _cell, cell, column in zip(widths, row_cell, cells, columns)\n ]\n\n if _box:\n if last and show_footer:\n yield _Segment(\n _box.get_row(widths, \"foot\", edge=show_edge), border_style\n )\n yield new_line\n left, right, _divider = box_segments[0 if first else (2 if last else 1)]\n\n # If the column divider is whitespace also style it with the row background\n divider = (\n _divider\n if _divider.text.strip()\n else _Segment(\n", "stderr": "", "exit_code": 0} |
| 12 | run_command | {
"command": "sed -n '775,795p' rich/table.py"
} | {"status": "ok", "stdout": " _Segment(_box.head_right, border_style),\n _Segment(_box.head_vertical, border_style),\n ),\n (\n _Segment(_box.foot_left, border_sfull{"status": "ok", "stdout": " _Segment(_box.head_right, border_style),\n _Segment(_box.head_vertical, border_style),\n ),\n (\n _Segment(_box.foot_left, border_style),\n _Segment(_box.foot_right, border_style),\n _Segment(_box.foot_vertical, border_style),\n ),\n (\n _Segment(_box.mid_left, border_style),\n _Segment(_box.mid_right, border_style),\n _Segment(_box.mid_vertical, border_style),\n ),\n ]\n if show_edge:\n yield _Segment(_box.get_top(widths), border_style)\n yield new_line\n else:\n box_segments = []\n\n get_row_style = self.get_row_style\n", "stderr": "", "exit_code": 0} |
| 13 | edit_file | {
"filepath": "rich/table.py",
"new_string": " (\n _Segment(_box.mid_left, border_style),\n _Segment(_box.mid_right, border_style),\n _Segment(_box.mid_vertical, border_style),\n ),\n (\n _Segment(_box.foot_left, border_style),\n _Segment(_box.foot_right, border_style),\n _Segment(_box.foot_vertical, border_style),\n ),",
"old_string": " (\n _Segment(_box.foot_left, border_style),\n _Segment(_box.foot_right, border_style),\n _Segment(_box.foot_vertical, border_style),\n ),\n (\n _Segment(_box.mid_left, border_style),\n _Segment(_box.mid_right, border_style),\n _Segment(_box.mid_vertical, border_style),\n ),"
} | {"status": "ok", "filepath": "rich/table.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/rich/table.py\n+++ b/rich/table.py\n@@ -776,14 +776,14 @@\n full{"status": "ok", "filepath": "rich/table.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/rich/table.py\n+++ b/rich/table.py\n@@ -776,14 +776,14 @@\n _Segment(_box.head_vertical, border_style),\n ),\n (\n+ _Segment(_box.mid_left, border_style),\n+ _Segment(_box.mid_right, border_style),\n+ _Segment(_box.mid_vertical, border_style),\n+ ),\n+ (\n _Segment(_box.foot_left, border_style),\n _Segment(_box.foot_right, border_style),\n _Segment(_box.foot_vertical, border_style),\n- ),\n- (\n- _Segment(_box.mid_left, border_style),\n- _Segment(_box.mid_right, border_style),\n- _Segment(_box.mid_vertical, border_style),\n ),\n ]\n if show_edge:\n", "is_truncated": false} |
| 14 | run_command | {
"command": "cat <<EOF > /tmp/test_box_order.py\nfrom rich.console import Console\nfrom rich.table import Table\nfrom rich import box\n\nconsole = Console(force_terminal=True)\n\n# We need a real Box object because CustomBox failed due to missing attributes.\n# Let's use a custom box string that makes it easy to see the order.\n# Box string format:\n# line 1: top_left, top, top_divider, top_right\n# line 2: head_left, _, head_vertical, head_right\n# line 3: head_row_left, head_row_horizontal, head_row_cross, head_row_right\n# line 4: mid_left, _, mid_vertical, mid_right\n# line 5: row_left, row_horizontal, row_cross, row_right\n# line 6: foot_row_left, foot_row_horizontal, foot_row_cross, foot_row_right\n# line 7: foot_left, _, foot_vertical, foot_right\n# line 8: bottom_left, bottom, bottom_divider, bottom_right\n\nbox_str = (\n \"TLTPTDTR\\n\" # top\n \"HL V HR\\n\" # head\n \"HRLHHC HR\\n\" # head_row\n \"ML V MR\\n\" # mid\n \"RLRHRC RR\\n\" # row\n \"FRLFHC FR\\n\" # foot_row\n \"FL V FR\\n\" # foot\n \"BLLBBD BR\" # bottom\n)\n\nmy_box = box.Box(box_str)\ntable = Table(box=my_box, show_header=True, show_footer=True)\ntable.add_column(\"A\")\ntable.add_column(\"B\")\n\ntable.add_row(\"1\", \"2\")\ntable.add_row(\"3\", \"4\")\ntable.add_row(\"5\", \"6\")\n\nwith console.capture() as capture:\n console.print(table)\n\nprint(capture.text)\nEOF\npython3 /tmp/test_box_order.py\n"
} | {"status": "error", "error_type": "CommandError", "error_message": "Traceback (most recent call last):\n File \"/tmp/test_box_order.py\", line 30, in <module>\nfull{"status": "error", "error_type": "CommandError", "error_message": "Traceback (most recent call last):\n File \"/tmp/test_box_order.py\", line 30, in <module>\n my_box = box.Box(box_str)\n File \"/workspace/rich/box.py\", line 38, in __init__\n self.top_left, self.top, self.top_divider, self.top_right = iter(line1)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nValueError: too many values to unpack (expected 4)\n", "details": {"stdout": "", "stderr": "Traceback (most recent call last):\n File \"/tmp/test_box_order.py\", line 30, in <module>\n my_box = box.Box(box_str)\n File \"/workspace/rich/box.py\", line 38, in __init__\n self.top_left, self.top, self.top_divider, self.top_right = iter(line1)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nValueError: too many values to unpack (expected 4)\n", "exit_code": 1}} |
| 15 | run_command | {
"command": "cat <<EOF > /tmp/test_box_order.py\nfrom rich.console import Console\nfrom rich.table import Table\nfrom rich import box\n\nconsole = Console(force_terminal=True)\n\nbox_str = (\n \"1234\\n\" # top\n \"5678\\n\" # head\n \"9012\\n\" # head_row\n \"3456\\n\" # mid\n \"7890\\n\" # row\n \"1234\\n\" # foot_row\n \"5678\\n\" # foot\n \"9012\" # bottom\n)\n\nmy_box = box.Box(box_str)\ntable = Table(box=my_box, show_header=True, show_footer=True)\ntable.add_column(\"A\")\ntable.add_column(\"B\")\n\ntable.add_row(\"1\", \"2\")\ntable.add_row(\"3\", \"4\")\ntable.add_row(\"5\", \"6\")\n\nwith console.capture() as capture:\n console.print(table)\n\nprint(capture.text)\nEOF\npython3 /tmp/test_box_order.py\n"
} | {"status": "error", "error_type": "CommandError", "error_message": "Traceback (most recent call last):\n File \"/tmp/test_box_order.py\", line 30, in <module>\nfull{"status": "error", "error_type": "CommandError", "error_message": "Traceback (most recent call last):\n File \"/tmp/test_box_order.py\", line 30, in <module>\n print(capture.text)\n ^^^^^^^^^^^^\nAttributeError: 'Capture' object has no attribute 'text'\n", "details": {"stdout": "", "stderr": "Traceback (most recent call last):\n File \"/tmp/test_box_order.py\", line 30, in <module>\n print(capture.text)\n ^^^^^^^^^^^^\nAttributeError: 'Capture' object has no attribute 'text'\n", "exit_code": 1}} |
| 16 | run_command | {
"command": "cat <<EOF > /tmp/test_box_order.py\nfrom rich.console import Console\nfrom rich.table import Table\nfrom rich import box\n\nconsole = Console(force_terminal=True)\n\nbox_str = (\n \"1234\\n\" # top\n \"5678\\n\" # head\n \"9012\\n\" # head_row\n \"3456\\n\" # mid\n \"7890\\n\" # row\n \"1234\\n\" # foot_row\n \"5678\\n\" # foot\n \"9012\" # bottom\n)\n\nmy_box = box.Box(box_str)\ntable = Table(box=my_box, show_header=True, show_footer=True)\ntable.add_column(\"A\")\ntable.add_column(\"B\")\n\ntable.add_row(\"1\", \"2\")\ntable.add_row(\"3\", \"4\")\ntable.add_row(\"5\", \"6\")\n\nwith console.capture() as capture:\n console.print(table)\n\nprint(capture)\nEOF\npython3 /tmp/test_box_order.py\n"
} | {"status": "ok", "stdout": "<rich.console.Capture object at 0x7a86dc494440>\n", "stderr": "", "exit_code": 0}full{"status": "ok", "stdout": "<rich.console.Capture object at 0x7a86dc494440>\n", "stderr": "", "exit_code": 0} |
| 17 | run_command | {
"command": "cat <<EOF > /tmp/test_box_order.py\nfrom rich.console import Console\nfrom rich.table import Table\nfrom rich import box\n\nconsole = Console(force_terminal=True)\n\nbox_str = (\n \"1234\\n\" # top\n \"5678\\n\" # head\n \"9012\\n\" # head_row\n \"3456\\n\" # mid\n \"7890\\n\" # row\n \"1234\\n\" # foot_row\n \"5678\\n\" # foot\n \"9012\" # bottom\n)\n\nmy_box = box.Box(box_str)\ntable = Table(box=my_box, show_header=True, show_footer=True)\ntable.add_column(\"A\")\ntable.add_column(\"B\")\n\ntable.add_row(\"1\", \"2\")\ntable.add_row(\"3\", \"4\")\ntable.add_row(\"5\", \"6\")\n\nwith console.capture() as capture:\n console.print(table)\n\nprint(capture.get())\nEOF\npython3 /tmp/test_box_order.py\n"
} | {"status": "ok", "stdout": "122232224\n5 A 7 B 8\n900010002\n3 1 5 2 6\n3 3 5 4 6\n3 5 5 6 6\n122232224\n5 7 8\n900010002\n\n", "stderr": "", "exit_code": 0}full{"status": "ok", "stdout": "122232224\n5 A 7 B 8\n900010002\n3 1 5 2 6\n3 3 5 4 6\n3 5 5 6 6\n122232224\n5 7 8\n900010002\n\n", "stderr": "", "exit_code": 0} |
| 18 | submit_patch | {} | {"status": "ok", "patch_size": 1099, "files_changed": 1}full{"status": "ok", "patch_size": 1099, "files_changed": 1} |
diff --git a/rich/table.py b/rich/table.py
index fe4054cf..44e457be 100644
--- a/rich/table.py
+++ b/rich/table.py
@@ -775,16 +775,16 @@ class Table(JupyterMixin):
_Segment(_box.head_right, border_style),
_Segment(_box.head_vertical, border_style),
),
- (
- _Segment(_box.foot_left, border_style),
- _Segment(_box.foot_right, border_style),
- _Segment(_box.foot_vertical, border_style),
- ),
(
_Segment(_box.mid_left, border_style),
_Segment(_box.mid_right, border_style),
_Segment(_box.mid_vertical, border_style),
),
+ (
+ _Segment(_box.foot_left, border_style),
+ _Segment(_box.foot_right, border_style),
+ _Segment(_box.foot_vertical, border_style),
+ ),
]
if show_edge:
yield _Segment(_box.get_top(widths), border_style)
................... [100%] 19 passed in 0.18s