We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8109b4d commit 4776ed1Copy full SHA for 4776ed1
1 file changed
src/a2a/utils/helpers.py
@@ -350,10 +350,16 @@ 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: cleaned_v for k, v in d.items() if (cleaned_v := _clean_empty(v)) is not None}
+ cleaned_dict = {
354
+ k: cleaned_v
355
+ for k, v in d.items()
356
+ if (cleaned_v := _clean_empty(v)) is not None
357
+ }
358
return cleaned_dict or None
359
if isinstance(d, list):
- cleaned_list = [cleaned_v for v in d if (cleaned_v := _clean_empty(v)) is not None]
360
+ cleaned_list = [
361
+ cleaned_v for v in d if (cleaned_v := _clean_empty(v)) is not None
362
+ ]
363
return cleaned_list or None
364
if isinstance(d, str) and not d:
365
return None
0 commit comments