From cb4747aed24d168e34e3a2bd0fd707003c2fd8bf Mon Sep 17 00:00:00 2001 From: froggleston Date: Sun, 4 Aug 2024 21:43:00 +0100 Subject: [PATCH] Add rich table width if jupyter in modules --- freqtrade/util/rich_tables.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/freqtrade/util/rich_tables.py b/freqtrade/util/rich_tables.py index d36bf9004..7ae315025 100644 --- a/freqtrade/util/rich_tables.py +++ b/freqtrade/util/rich_tables.py @@ -37,8 +37,12 @@ def print_rich_table( row_to_add: List[Union[str, Text]] = [r if isinstance(r, Text) else str(r) for r in row] table.add_row(*row_to_add) + width = None + if any(module in ["pytest", "ipykernel"] for module in sys.modules): + width = 200 + console = Console( - width=200 if "pytest" in sys.modules else None, + width=width ) console.print(table) @@ -71,7 +75,11 @@ def print_df_rich_table( row = [_format_value(x, floatfmt=".3f") for x in value_list] table.add_row(*row) + width = None + if any(module in ["pytest", "ipykernel"] for module in sys.modules): + width = 200 + console = Console( - width=200 if "pytest" in sys.modules else None, + width=width ) console.print(table)