From 3a1a0c0ed7cf22bb9fef0f154827e55b3504ace9 Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Thu, 6 Feb 2025 12:13:03 +0100 Subject: [PATCH] Better error message --- personal_data/util.py | 1 + 1 file changed, 1 insertion(+) diff --git a/personal_data/util.py b/personal_data/util.py index 32e4135..9aa3de8 100644 --- a/personal_data/util.py +++ b/personal_data/util.py @@ -97,6 +97,7 @@ def dataclass_to_dict(obj) -> dict[str, Any]: def normalize_dict(d: dict[str, Any] | frozendict[str, Any]) -> frozendict[str, Any]: if not isinstance(d, dict) and not isinstance(d, frozendict): d = dataclass_to_dict(d) + assert isinstance(d, dict) or isinstance(d, frozendict), 'Not a dict' safe_values = [(k, csv_import.csv_str_to_value(csv_import.csv_safe_value(v))) for k, v in d.items() ] return frozendict( {k:v for k,v in safe_values if v is not None})