Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render Group #1819

Merged
merged 2 commits into from Jan 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Expand Up @@ -5,7 +5,6 @@ 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).


## [11.0.0] - Unreleased

### Added
Expand All @@ -14,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added max_depth arg to pretty printing
- Fix Traceback theme defaults override user supplied styles https://github.com/Textualize/rich/issues/1786

### Changed

- **breaking** Deprecated rich.console.RenderGroup, now named rich.console.Group

## [10.16.2] - 2021-01-02

### Fixed
Expand Down
17 changes: 6 additions & 11 deletions rich/console.py
Expand Up @@ -11,9 +11,9 @@
from html import escape
from inspect import isclass
from itertools import islice
from time import monotonic
from threading import RLock
from types import FrameType, TracebackType, ModuleType
from time import monotonic
from types import FrameType, ModuleType, TracebackType
from typing import (
IO,
TYPE_CHECKING,
Expand Down Expand Up @@ -258,11 +258,12 @@ def __rich_console__(
...


# A type that may be rendered by Console.
RenderableType = Union[ConsoleRenderable, RichCast, str]
"""A type that may be rendered by Console."""


# The result of calling a __rich_console__ method.
RenderResult = Iterable[Union[RenderableType, Segment]]
"""The result of calling a __rich_console__ method."""


_null_highlighter = NullHighlighter()
Expand Down Expand Up @@ -475,9 +476,6 @@ def __rich_console__(
yield from self.renderables


RenderGroup = Group # TODO: deprecate at some point


def group(fit: bool = True) -> Callable[..., Callable[..., Group]]:
"""A decorator that turns an iterable of renderables in to a group.

Expand All @@ -488,7 +486,7 @@ def group(fit: bool = True) -> Callable[..., Callable[..., Group]]:
def decorator(
method: Callable[..., Iterable[RenderableType]]
) -> Callable[..., Group]:
"""Convert a method that returns an iterable of renderables in to a RenderGroup."""
"""Convert a method that returns an iterable of renderables in to a Group."""

@wraps(method)
def _replace(*args: Any, **kwargs: Any) -> Group:
Expand All @@ -500,9 +498,6 @@ def _replace(*args: Any, **kwargs: Any) -> Group:
return decorator


render_group = group


def _is_jupyter() -> bool: # pragma: no cover
"""Check if we're running in a Jupyter notebook."""
try:
Expand Down