_abnf, _app, _http, _url: [PEP 8] Fix indents
This commit is contained in:
@@ -68,7 +68,7 @@ VALID_CLOSE_STATUS = (
|
||||
STATUS_MESSAGE_TOO_BIG,
|
||||
STATUS_INVALID_EXTENSION,
|
||||
STATUS_UNEXPECTED_CONDITION,
|
||||
)
|
||||
)
|
||||
|
||||
class ABNF(object):
|
||||
"""
|
||||
@@ -87,7 +87,7 @@ class ABNF(object):
|
||||
|
||||
# available operation code value tuple
|
||||
OPCODES = (OPCODE_CONT, OPCODE_TEXT, OPCODE_BINARY, OPCODE_CLOSE,
|
||||
OPCODE_PING, OPCODE_PONG)
|
||||
OPCODE_PING, OPCODE_PONG)
|
||||
|
||||
# opcode human readable string
|
||||
OPCODE_MAP = {
|
||||
@@ -97,7 +97,7 @@ class ABNF(object):
|
||||
OPCODE_CLOSE: "close",
|
||||
OPCODE_PING: "ping",
|
||||
OPCODE_PONG: "pong"
|
||||
}
|
||||
}
|
||||
|
||||
# data length threshold.
|
||||
LENGTH_7 = 0x7e
|
||||
|
@@ -168,16 +168,16 @@ class WebSocketApp(object):
|
||||
close_frame = None
|
||||
|
||||
try:
|
||||
self.sock = WebSocket(self.get_mask_key,
|
||||
sockopt=sockopt, sslopt=sslopt,
|
||||
self.sock = WebSocket(
|
||||
self.get_mask_key, sockopt=sockopt, sslopt=sslopt,
|
||||
fire_cont_frame=self.on_cont_message and True or False,
|
||||
skip_utf8_validation=skip_utf8_validation)
|
||||
self.sock.settimeout(getdefaulttimeout())
|
||||
self.sock.connect(self.url, header=self.header, cookie=self.cookie,
|
||||
self.sock.connect(
|
||||
self.url, header=self.header, cookie=self.cookie,
|
||||
http_proxy_host=http_proxy_host,
|
||||
http_proxy_port=http_proxy_port,
|
||||
http_no_proxy=http_no_proxy, http_proxy_auth=http_proxy_auth,
|
||||
subprotocols=self.subprotocols,
|
||||
http_proxy_port=http_proxy_port, http_no_proxy=http_no_proxy,
|
||||
http_proxy_auth=http_proxy_auth, subprotocols=self.subprotocols,
|
||||
host=host, origin=origin)
|
||||
self._callback(self.on_open)
|
||||
|
||||
@@ -227,8 +227,9 @@ class WebSocketApp(object):
|
||||
thread.join()
|
||||
self.keep_running = False
|
||||
self.sock.close()
|
||||
self._callback(self.on_close,
|
||||
*self._get_close_args(close_frame.data if close_frame else None))
|
||||
close_args = self._get_close_args(
|
||||
close_frame.data if close_frame else None)
|
||||
self._callback(self.on_close, *close_args)
|
||||
self.sock = None
|
||||
|
||||
def _get_close_args(self, data):
|
||||
|
@@ -124,7 +124,7 @@ def _get_resp_headers(sock, success_status=101):
|
||||
_HEADERS_TO_CHECK = {
|
||||
"upgrade": "websocket",
|
||||
"connection": "upgrade",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def _validate(headers, key, subprotocols):
|
||||
|
@@ -82,8 +82,8 @@ def connect(url, options, proxy, socket):
|
||||
|
||||
|
||||
def _get_addrinfo_list(hostname, port, is_secure, proxy):
|
||||
phost, pport, pauth = get_proxy_info(hostname, is_secure,
|
||||
proxy.host, proxy.port, proxy.auth, proxy.no_proxy)
|
||||
phost, pport, pauth = get_proxy_info(
|
||||
hostname, is_secure, proxy.host, proxy.port, proxy.auth, proxy.no_proxy)
|
||||
if not phost:
|
||||
addrinfo_list = socket.getaddrinfo(hostname, port, 0, 0, socket.SOL_TCP)
|
||||
return addrinfo_list, False, None
|
||||
|
@@ -82,8 +82,9 @@ def _is_no_proxy_host(hostname, no_proxy):
|
||||
return hostname in no_proxy
|
||||
|
||||
|
||||
def get_proxy_info(hostname, is_secure,
|
||||
proxy_host=None, proxy_port=0, proxy_auth=None, no_proxy=None):
|
||||
def get_proxy_info(
|
||||
hostname, is_secure, proxy_host=None, proxy_port=0, proxy_auth=None,
|
||||
no_proxy=None):
|
||||
"""
|
||||
try to retrieve proxy host and port from environment
|
||||
if not provided in options.
|
||||
|
Reference in New Issue
Block a user