Skip to content

Commit 421cc4e

Browse files
committed
fix typing in add_listener and remove_listener
Use the union to typecheck these functions
1 parent cb3d4dc commit 421cc4e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

can/notifier.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def _on_error(self, exc: Exception) -> bool:
166166

167167
return was_handled
168168

169-
def add_listener(self, listener: Listener) -> None:
169+
def add_listener(self, listener: MessageRecipient) -> None:
170170
"""Add new Listener to the notification list.
171171
If it is already present, it will be called two times
172172
each time a message arrives.
@@ -175,7 +175,7 @@ def add_listener(self, listener: Listener) -> None:
175175
"""
176176
self.listeners.append(listener)
177177

178-
def remove_listener(self, listener: Listener) -> None:
178+
def remove_listener(self, listener: MessageRecipient) -> None:
179179
"""Remove a listener from the notification list. This method
180180
throws an exception if the given listener is not part of the
181181
stored listeners.

0 commit comments

Comments
 (0)