Skip to content

Commit

Permalink
fix: defaultdict
Browse files Browse the repository at this point in the history
  • Loading branch information
dtdang committed Jan 14, 2025
1 parent f884ea0 commit 795f24b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions silverback/cluster/client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from collections import defaultdict
from datetime import datetime
from functools import cache
from typing import ClassVar, Literal
Expand Down Expand Up @@ -299,10 +300,10 @@ def bots(self) -> dict[str, Bot]:
def bots_list(self) -> dict[str, list[Bot]]:
response = self.get("/bots")
handle_error_with_response(response)
bots_dict: dict[str, list[Bot]] = {}
bots_dict = defaultdict(list)
for bot in map(Bot.model_validate, response.json()):
bots_dict.setdefault(bot.name, []).append(bot)
return bots_dict
bots_dict[bot.name].append(bot)
return dict(bots_dict)

def new_bot(
self,
Expand Down

0 comments on commit 795f24b

Please sign in to comment.