summaryrefslogtreecommitdiff
path: root/websocket
diff options
context:
space:
mode:
authorliris <liris.pp@gmail.com>2018-10-28 10:27:27 +0900
committerGitHub <noreply@github.com>2018-10-28 10:27:27 +0900
commitbb3159de4f50f18626e3762fbc8356619fcd74ec (patch)
treebe061b4d9287e66da150532ba250e93be9e0e545 /websocket
parent0153ae416db9c21b172b7a249911bd29579d978d (diff)
parent656b22b8813b369f0c0b6613c1033d930b7d074c (diff)
downloadwebsocket-client-bb3159de4f50f18626e3762fbc8356619fcd74ec.tar.gz
Merge pull request #487 from instance01/pep8
Diffstat (limited to 'websocket')
-rw-r--r--websocket/_app.py10
-rw-r--r--websocket/_http.py2
2 files changed, 6 insertions, 6 deletions
diff --git a/websocket/_app.py b/websocket/_app.py
index e5ea661..9cea877 100644
--- a/websocket/_app.py
+++ b/websocket/_app.py
@@ -48,7 +48,7 @@ class Dispatcher:
def read(self, sock, read_callback, check_callback):
while self.app.sock.connected:
r, w, e = select.select(
- (self.app.sock.sock, ), (), (), self.ping_timeout)
+ (self.app.sock.sock, ), (), (), self.ping_timeout)
if r:
if not read_callback():
break
@@ -206,13 +206,13 @@ class WebSocketApp(object):
True if other exception was raised during a loop
"""
- if ping_timeout is not None and (not ping_timeout or ping_timeout <= 0):
+ if ping_timeout is not None and ping_timeout <= 0:
ping_timeout = None
if ping_timeout and ping_interval and ping_interval <= ping_timeout:
raise WebSocketException("Ensure ping_interval > ping_timeout")
- if sockopt is None:
+ if not sockopt:
sockopt = []
- if sslopt is None:
+ if not sslopt:
sslopt = {}
if self.sock:
raise WebSocketException("socket is already opened")
@@ -237,7 +237,7 @@ class WebSocketApp(object):
try:
self.sock = WebSocket(
self.get_mask_key, sockopt=sockopt, sslopt=sslopt,
- fire_cont_frame=self.on_cont_message and True or False,
+ fire_cont_frame=self.on_cont_message is not None,
skip_utf8_validation=skip_utf8_validation,
enable_multithread=True if ping_interval else False)
self.sock.settimeout(getdefaulttimeout())
diff --git a/websocket/_http.py b/websocket/_http.py
index 8d82521..fe97480 100644
--- a/websocket/_http.py
+++ b/websocket/_http.py
@@ -101,7 +101,7 @@ def _open_proxied_socket(url, options, proxy):
def connect(url, options, proxy, socket):
- if proxy.host and not socket and not(proxy.type == 'http'):
+ if proxy.host and not socket and not (proxy.type == 'http'):
return _open_proxied_socket(url, options, proxy)
hostname, port, resource, is_secure = parse_url(url)