We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 589b97a commit 7f63f64Copy full SHA for 7f63f64
1 file changed
src/a2a/utils/helpers.py
@@ -350,8 +350,7 @@ def are_modalities_compatible(
350
def _clean_empty(d: Any) -> Any:
351
"""Recursively remove empty strings, lists and dicts from a dictionary."""
352
if isinstance(d, dict):
353
- cleaned_dict = {k: _clean_empty(v) for k, v in d.items()}
354
- cleaned_dict = {k: v for k, v in cleaned_dict.items() if v is not None}
+ cleaned_dict = {k: cleaned_v for k, v in d.items() if (cleaned_v := _clean_empty(v)) is not None}
355
return cleaned_dict or None
356
if isinstance(d, list):
357
cleaned_list = [_clean_empty(v) for v in d]
0 commit comments