Skip to content

Commit b689c54

Browse files
Apply suggestions from code review
Co-authored-by: Paillat <[email protected]> Signed-off-by: VincentRPS <[email protected]>
1 parent f0554c3 commit b689c54

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

discord/app/event_emitter.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class EventEmitter:
4444
def __init__(self, state: ConnectionState) -> None:
4545
self._listeners: dict[type[Event], list[Callable]] = {}
4646
self._events: dict[str, list[type[Event]]]
47-
self._wait_fors: dict[type[Event], list[Future]] = {}
47+
self._wait_fors: dict[type[Event], list[Future]] = defaultdict(list)
4848
self._state = state
4949

5050
def add_event(self, event: type[Event]) -> None:
@@ -69,10 +69,7 @@ def remove_listener(self, event: type[Event], listener: Callable) -> None:
6969
def add_wait_for(self, event: type[T]) -> Future[T]:
7070
fut = Future()
7171

72-
try:
73-
self._wait_fors[event].append(fut)
74-
except KeyError:
75-
self._wait_fors[event] = [fut]
72+
self._wait_fors[event].append(fut)
7673

7774
return fut
7875

0 commit comments

Comments
 (0)