diff options
author | liris <liris.pp@gmail.com> | 2018-08-19 20:02:13 +0900 |
---|---|---|
committer | liris <liris.pp@gmail.com> | 2018-08-19 20:02:13 +0900 |
commit | ae589495b75162703ab4fe1f8712f50d22b12d4e (patch) | |
tree | 8f41a869365a028128e9e3c0eed5f68ca8441ca4 /websocket/_app.py | |
parent | 8a8a2eb5d455b41a355b2e1ae93bf3323f333c74 (diff) | |
download | websocket-client-ae589495b75162703ab4fe1f8712f50d22b12d4e.tar.gz |
revert #442v0.51.0
Diffstat (limited to 'websocket/_app.py')
-rw-r--r-- | websocket/_app.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/websocket/_app.py b/websocket/_app.py index 90244b7..970f3bd 100644 --- a/websocket/_app.py +++ b/websocket/_app.py @@ -127,16 +127,16 @@ class WebSocketApp(object): self.header = header if header is not None else [] self.cookie = cookie - self.on_open = on_open or getattr(self, 'on_open', None) - self.on_message = on_message or getattr(self, 'on_message', None) - self.on_data = on_data or getattr(self, 'on_data', None) - self.on_error = on_error or getattr(self, 'on_error', None) - self.on_close = on_close or getattr(self, 'on_close', None) - self.on_ping = on_ping or getattr(self, 'on_ping', None) - self.on_pong = on_pong or getattr(self, 'on_pong', None) - self.on_cont_message = on_cont_message or getattr(self, 'on_cont_message', None) - self.get_mask_key = get_mask_key or getattr(self, 'get_mask_key', None) + self.on_open = on_open + self.on_message = on_message + self.on_data = on_data + self.on_error = on_error + self.on_close = on_close + self.on_ping = on_ping + self.on_pong = on_pong + self.on_cont_message = on_cont_message self.keep_running = False + self.get_mask_key = get_mask_key self.sock = None self.last_ping_tm = 0 self.last_pong_tm = 0 @@ -311,7 +311,6 @@ class WebSocketApp(object): def _get_close_args(self, data): """ this functions extracts the code, reason from the close body if they exists, and if the self.on_close except three arguments """ - import inspect # if the on_close callback is "old", just return empty list if sys.version_info < (3, 0): if not self.on_close or len(inspect.getargspec(self.on_close).args) != 3: @@ -330,7 +329,7 @@ class WebSocketApp(object): def _callback(self, callback, *args): if callback: try: - if inspect.ismethod(callback) and isinstance(callback.__self__, WebSocketApp): + if inspect.ismethod(callback): callback(*args) else: callback(self, *args) |