MCPcopy Index your code
hub / github.com/pyscript/pyscript / __setattr__

Method __setattr__

core/src/stdlib/pyscript/websocket.py:233–244  ·  view source on GitHub ↗

Set an attribute `attr` on the WebSocket to the given `value`. Event handler attributes (`onopen`, `onmessage`, etc.) are specially handled to create proper proxies. Other attributes are set on the underlying WebSocket directly.

(self, attr, value)

Source from the content-addressed store, hash-verified

231 return getattr(self._js_websocket, attr)
232
233 def __setattr__(self, attr, value):
234 """
235 Set an attribute `attr` on the WebSocket to the given `value`.
236
237 Event handler attributes (`onopen`, `onmessage`, etc.) are specially
238 handled to create proper proxies. Other attributes are set on the
239 underlying WebSocket directly.
240 """
241 if attr in ["onclose", "onerror", "onmessage", "onopen"]:
242 _attach_event_handler(self._js_websocket, attr, value)
243 else:
244 setattr(self._js_websocket, attr, value)
245
246 def send(self, data):
247 """

Callers 1

__init__Method · 0.45

Calls 1

_attach_event_handlerFunction · 0.85

Tested by

no test coverage detected