Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions can/notifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def __init__(
:raises ValueError:
If a passed in *bus* is already assigned to an active :class:`~can.Notifier`.
"""
self.listeners: list[MessageRecipient] = list(listeners)
self.listeners: set[MessageRecipient] = set(listeners)
self._bus_list: list[BusABC] = []
self.timeout = timeout
self._loop = loop
Expand Down Expand Up @@ -278,20 +278,18 @@ def _on_error(self, exc: Exception) -> bool:
return was_handled

def add_listener(self, listener: MessageRecipient) -> None:
"""Add new Listener to the notification list.
If it is already present, it will be called two times
each time a message arrives.
"""Add new Listener to the notification set.

:param listener: Listener to be added to the list to be notified
"""
self.listeners.append(listener)
self.listeners.add(listener)

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

:param listener: Listener to be removed from the list to be notified
:param listener: Listener to be removed from the set to be notified
:raises ValueError: if `listener` was never added to this notifier
"""
self.listeners.remove(listener)
Expand Down
Loading