mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 09:47:52 +00:00
Fix hassfest serializer injecting commas in empty lists (#83052)
* No trailing comma for empty lists * Update script/hassfest/serializer.py Co-authored-by: Aarni Koskela <akx@iki.fi> Co-authored-by: Paulus Schoutsen <balloob@gmail.com> Co-authored-by: Aarni Koskela <akx@iki.fi>
This commit is contained in:
parent
87b6bb45d0
commit
1d1b59b800
@ -21,7 +21,9 @@ def _wrap_items(
|
|||||||
# on one line and some on multiple.
|
# on one line and some on multiple.
|
||||||
if sort:
|
if sort:
|
||||||
items = sorted(items)
|
items = sorted(items)
|
||||||
return f"{opener}{','.join(items)},{closer}"
|
|
||||||
|
joined_items = ", ".join(items)
|
||||||
|
return f"{opener}{joined_items}{',' if joined_items else ''}{closer}"
|
||||||
|
|
||||||
|
|
||||||
def _mapping_to_str(data: Mapping[Any, Any]) -> str:
|
def _mapping_to_str(data: Mapping[Any, Any]) -> str:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user