← mined_oracle

rich_2043

failed WRONG_FIX UNSUBMITTED wrong_fix_unsubmitted(None) · None tool calls · 0 s · Textualize/rich

Task input

(not found in data/tasks.jsonl)

Tool calls (0)

#ToolArgumentsResult
No trace captured.

Patch

--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,3 @@
-
 # Changelog
 
 All notable changes to this project will be documented in this file.
@@ -6,7 +5,7 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
-## Unreleased
+## [12.0.0] - Unreleased
 
 ### Added
 
@@ -15,7 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - Added ProgressColumn `MofNCompleteColumn` to display raw `completed/total` column (similar to DownloadColumn,
   but displays values as ints, does not convert to floats or add bit/bytes units).
   https://github.com/Textualize/rich/pull/1941
-- Remove Colorama dependency, call Windows Console API from Rich https://github.com/Textualize/rich/pull/1993
+- Replace Colorama with win32 renderer https://github.com/Textualize/rich/pull/1993
 - Add support for namedtuples to `Pretty` https://github.com/Textualize/rich/pull/2031
 
 ### Fixed
@@ -25,14 +24,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - Fix syntax lexer guessing.
 - Fixed Pretty measure not respecting expand_all https://github.com/Textualize/rich/issues/1998
 - Collapsed definitions for single-character spinners, to save memory and reduce import time.
-- Fix print_json indent type in __init__.py
+- Fix print_json indent type in **init**.py
 - Fix error when inspecting object defined in REPL https://github.com/Textualize/rich/pull/2037
 - Fix incorrect highlighting of non-indented JSON https://github.com/Textualize/rich/pull/2038
+- Fixed height reset in complex renderables https://github.com/Textualize/rich/issues/2042
 
 ### Changed
 
 - Improved support for enum.Flag in ReprHighlighter https://github.com/Textualize/rich/pull/1920
 - Tree now respects justify=None, i.e. won't pad to right https://github.com/Textualize/rich/issues/1690
+- Removed rich.tabulate which was marked for deprecation
+- Deprecated rich.align.AlignValues in favor of AlignMethod
 
 ## [11.2.0] - 2022-02-08
 
@@ -1661,7 +1663,7 @@ Major version bump for a breaking change to `Text.stylize signature`, which corr
 
 - First official release, API still to be stabilized
 
-[Unreleased]: https://github.com/willmcgugan/rich/compare/v11.0.0...HEAD
+[unreleased]: https://github.com/willmcgugan/rich/compare/v11.0.0...HEAD
 [11.2.0]: https://github.com/willmcgugan/rich/compare/v11.1.0...v11.2.0
 [11.1.0]: https://github.com/willmcgugan/rich/compare/v11.0.0...v11.1.0
 [11.0.0]: https://github.com/willmcgugan/rich/compare/v10.16.1...v11.0.0
--- a/rich/align.py
+++ b/rich/align.py
@@ -18,7 +18,6 @@ if TYPE_CHECKING:
 
 AlignMethod = Literal["left", "center", "right"]
 VerticalAlignMethod = Literal["top", "middle", "bottom"]
-AlignValues = AlignMethod  # TODO: deprecate AlignValues
 
 
 class Align(JupyterMixin):
--- a/rich/console.py
+++ b/rich/console.py
@@ -224,6 +224,16 @@ class ConsoleOptions:
         options.max_height = options.height = height
         return options
 
+    def reset_height(self) -> "ConsoleOptions":
+        """Resets the height to None.
+
+        Returns:
+            ~ConsoleOptions: New console options instance.
+        """
+        options = self.copy()
+        options.height = None
+        return options
+
     def update_dimensions(self, width: int, height: int) -> "ConsoleOptions":
         """Update the width and height, and return a copy.
 
@@ -1245,6 +1255,7 @@ class Console:
                 f"object {render_iterable!r} is not renderable"
             )
         _Segment = Segment
+        _options = _options.reset_height()
         for render_output in iter_render:
             if isinstance(render_output, _Segment):
                 yield render_output
--- a/rich/layout.py
+++ b/rich/layout.py
@@ -73,6 +73,7 @@ class _Placeholder:
             style=self.style,
             title=self.highlighter(title),
             border_style="blue",
+            height=height,
         )
 
 
--- a/rich/tabulate.py
+++ /dev/null
@@ -1,51 +0,0 @@
-from collections.abc import Mapping
-from typing import Any, Optional
-import warnings
-
-from rich.console import JustifyMethod
-
-from . import box
-from .highlighter import ReprHighlighter
-from .pretty import Pretty
-from .table import Table
-
-
-def tabulate_mapping(
-    mapping: "Mapping[Any, Any]",
-    title: Optional[str] = None,
-    caption: Optional[str] = None,
-    title_justify: Optional[JustifyMethod] = None,
-    caption_justify: Optional[JustifyMethod] = None,
-) -> Table:
-    """Generate a simple table from a mapping.
-
-    Args:
-        mapping (Mapping): A mapping object (e.g. a dict);
-        title (str, optional): Optional title to be displayed over the table.
-        caption (str, optional): Optional caption to be displayed below the table.
-        title_justify (str, optional): Justify method for title. Defaults to None.
-        caption_justify (str, optional): Justify method for caption. Defaults to None.
-
-    Returns:
-        Table: A table instance which may be rendered by the Console.
-    """
-    warnings.warn("tabulate_mapping will be deprecated in Rich v11", DeprecationWarning)
-    table = Table(
-        show_header=False,
-        title=title,
-        caption=caption,
-        box=box.ROUNDED,
-        border_style="blue",
-    )
-    table.title = title
-    table.caption = caption
-    if title_justify is not None:
-        table.title_justify = title_justify
-    if caption_justify is not None:
-        table.caption_justify = caption_justify
-    highlighter = ReprHighlighter()
-    for key, value in mapping.items():
-        table.add_row(
-            Pretty(key, highlighter=highlighter), Pretty(value, highlighter=highlighter)
-        )
-    return table

Test output

show
.............F
=================================== FAILURES ===================================
_______________________________ test_print_json ________________________________

    def test_print_json():
        console = Console(file=io.StringIO(), color_system="truecolor")
        console.print_json('[false, true, null, "foo"]', indent=4)
        result = console.file.getvalue()
        print(repr(result))
        expected = '\x1b[1m[\x1b[0m\n    \x1b[3;91mfalse\x1b[0m,\n    \x1b[3;92mtrue\x1b[0m,\n    \x1b[3;35mnull\x1b[0m,\n    \x1b[32m"foo"\x1b[0m\n\x1b[1m]\x1b[0m\n'
>       assert result == expected
E       AssertionError: assert '\x1b[1m[\x1b...[1m]\x1b[0m\n' == '\x1b[1m[\x1b...[1m]\x1b[0m\n'
E         
E           [
E         -     false,
E         ?        ---
E         +     false,
E         -     true,
E         ?        ---...
E         
E         ...Full output truncated (7 lines hidden), use '-vv' to show

tests/test_console.py:161: AssertionError
----------------------------- Captured stdout call -----------------------------
'\x1b[1m[\x1b[0m\n    \x1b[3mfalse\x1b[0m,\n    \x1b[3mtrue\x1b[0m,\n    \x1b[3mnull\x1b[0m,\n    "foo"\n\x1b[1m]\x1b[0m\n'
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 13 passed in 0.16s