Skip to content

Commit

Permalink
chore: force_terminal to False in __repr__
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Sep 3, 2024
1 parent 7c1dab6 commit c064941
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ibis/expr/types/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()

Expand Down

0 comments on commit c064941

Please sign in to comment.