From c064941c42e53281c7b50d21cf34b33c09f456e5 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Tue, 3 Sep 2024 10:31:31 -0400 Subject: [PATCH] chore: force_terminal to False in `__repr__` --- ibis/expr/types/core.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ibis/expr/types/core.py b/ibis/expr/types/core.py index d4eeb48989394..de645aa4fa4ac 100644 --- a/ibis/expr/types/core.py +++ b/ibis/expr/types/core.py @@ -33,10 +33,12 @@ from ibis.expr.visualize import EdgeAttributeGetter, NodeAttributeGetter -def _capture_rich_renderable(renderable: RenderableType) -> str: - from rich import get_console +def _capture_rich_renderable( + renderable: RenderableType, *, force_terminal: bool | None = None +) -> str: + from rich.console import Console - console = get_console() + console = Console(force_terminal=force_terminal) with console.capture() as capture: console.print(renderable) return capture.get().rstrip() @@ -58,7 +60,7 @@ def _noninteractive_repr(self) -> str: def __repr__(self) -> str: if opts.interactive: - return _capture_rich_renderable(self) + return _capture_rich_renderable(self, force_terminal=False) else: return self._noninteractive_repr()