self.clients was already a set. cannot subscript

This commit is contained in:
Andrew 2022-09-22 21:42:58 -04:00
parent ff78e711d0
commit e2c846205b

View File

@ -27,7 +27,7 @@ class WebSocketHelper:
f"Sending to {len(self.clients)} clients: "
f"{json.dumps({'event': event_type, 'data': data})}"
)
for client in self.clients[:]: # pylint: disable=unsubscriptable-object
for client in self.clients:
try:
self.send_message(client, event_type, data)
except Exception as e:
@ -36,9 +36,6 @@ class WebSocketHelper:
f"{client.get_remote_ip()} {e}"
)
# Excempting 'unsubscriptable-object' warning as false positive from 'self' use
# Code has been tested by Andrew and functions as intended.
def broadcast_page(self, page: str, event_type: str, data):
def filter_fn(client):
return client.page == page