Skip to content

Commit ae442bf

Browse files
committed
Automatic backup 2025-09-01
1 parent acdcad7 commit ae442bf

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

rich_tables/diff.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ def _(before: HashableList[Any], after: HashableList[Any]) -> Any:
134134

135135
@diff.register
136136
def _(before: HashableDict, after: HashableDict) -> dict[str, str]:
137+
print(f"{before=}, {after=}")
137138
data = {}
138139
keys = dict.fromkeys((*before, *after))
139140
for key in keys:
@@ -157,6 +158,11 @@ def _(before: None, after: HashableDict) -> dict[str, str]:
157158
return diff(HashableDict(), after)
158159

159160

161+
@diff.register
162+
def _(before: None, after: HashableList) -> list[str, str]:
163+
return diff(HashableList(), after)
164+
165+
160166
def pretty_diff(before: Any, after: Any) -> str:
161167
"""Generate a Rich Text object showing differences between any two Python objects.
162168

rich_tables/fields.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ def add_count_bars(
5454
else:
5555
new_count_key = count_key
5656

57-
all_counts = [float(i[count_key]) for i in data]
57+
for item in data:
58+
item[count_key] = float(item[count_key])
59+
if subcount_key:
60+
item[subcount_key] = float(item[subcount_key])
61+
62+
all_counts = [i[count_key] for i in data]
5863
max_value = max(all_counts)
5964

6065
bar_key = f"{new_count_key}_bar"

0 commit comments

Comments
 (0)