From 3fd7a5f97763200dc06ed43c1556f0de32c322ed Mon Sep 17 00:00:00 2001 From: anna-charlotte Date: Thu, 23 Mar 2023 20:13:11 +0100 Subject: [PATCH] fix: add int, float and others to doc summary Signed-off-by: anna-charlotte --- docarray/display/document_summary.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docarray/display/document_summary.py b/docarray/display/document_summary.py index 982affbad14..e8c6f818ea9 100644 --- a/docarray/display/document_summary.py +++ b/docarray/display/document_summary.py @@ -137,7 +137,7 @@ def __rich_console__( table.add_row(col_1, text.Text(col_2)) elif isinstance(value, AbstractTensor): table.add_row(col_1, TensorDisplay(tensor=value)) - elif isinstance(value, (tuple, list, set)): + elif isinstance(value, (tuple, list, set, frozenset)): value_list = list(value) col_2 = '' for i, x in enumerate(value_list): @@ -149,7 +149,7 @@ def __rich_console__( if type(value) == tuple: col_2 = col_2.replace('[', '(', 1).replace(']', ')', -1) - if type(value) == set: + if type(value) == set or type(value) == frozenset: col_2 = col_2.replace('[', '{', 1).replace(']', '}', -1) table.add_row(col_1, text.Text(col_2)) @@ -158,6 +158,9 @@ def __rich_console__( if len(col_2) > 50: col_2 = f'{col_2[: 50]}' + ' ... } ' + f'(length: {len(value)})' table.add_row(col_1, text.Text(col_2)) + else: + col_2 = f'{value}' + table.add_row(col_1, text.Text(col_2)) if table.rows: yield table