Improve rich generic

This commit is contained in:
Matthias 2024-07-07 13:08:52 +02:00
parent 296bf9dc1d
commit 4d5b330b77

View File

@ -27,13 +27,15 @@ def print_rich_table(
if isinstance(row, dict):
table.add_row(
*[
row[header] if isinstance(row[header], (Text, Table)) else str(row[header])
row[header] if isinstance(row[header], Text) else str(row[header])
for header in headers
]
)
else:
table.add_row(*[r if isinstance(r, (Text, Table)) else str(r) for r in row])
table.add_row(
*[r if isinstance(r, Text) else str(r) for r in row], # type: ignore[arg-type]
)
console = Console(
width=200 if "pytest" in sys.modules else None,