Commit b5619042 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Applied pyflakes & pep8

parent 667d6115
......@@ -146,7 +146,7 @@ class Connection(object):
frame = self.sock.recv()
if frame.opcode != OPCODE_CLOSE:
raise ValueError('expected CLOSE frame, got %s instead' % frame)
raise ValueError('expected CLOSE frame, got %s' % frame)
res_code, res_reason = frame.unpack_close()
......
......@@ -3,8 +3,6 @@ import socket
from os import urandom
from string import printable
from errors import SocketClosed
OPCODE_CONTINUATION = 0x0
OPCODE_TEXT = 0x1
......@@ -154,7 +152,7 @@ class Frame(object):
pl = printstr(self.payload)[:max_pl_disp]
if len(self.payload) > max_pl_disp:
pl += '...'
pl += '...'
return s + ' payload=%s>' % pl
......@@ -176,7 +174,7 @@ class ControlFrame(Frame):
125 bytes.
"""
if len(self.payload) > 125:
raise ValueError('control frames must not be larger than 125' \
raise ValueError('control frames must not be larger than 125 '
'bytes')
return Frame.pack(self)
......
......@@ -42,8 +42,8 @@ class websocket(object):
>>> sock.connect(('', 8000))
>>> sock.send(twspy.Frame(twspy.OPCODE_TEXT, 'Hello, Server!'))
"""
def __init__(self, sock=None, protocols=[], extensions=[], sfamily=socket.AF_INET,
sproto=0):
def __init__(self, sock=None, protocols=[], extensions=[],
sfamily=socket.AF_INET, sproto=0):
"""
Create a regular TCP socket of family `family` and protocol
......@@ -251,10 +251,12 @@ class websocket(object):
# Request protocols and extension, these are later checked with the
# actual supported values from the server's response
if self.protocols:
shake += 'Sec-WebSocket-Protocol: %s\r\n' % ', '.join(self.protocols)
shake += 'Sec-WebSocket-Protocol: %s\r\n' \
% ', '.join(self.protocols)
if self.extensions:
shake += 'Sec-WebSocket-Extensions: %s\r\n' % ', '.join(self.extensions)
shake += 'Sec-WebSocket-Extensions: %s\r\n' \
% ', '.join(self.extensions)
if auth:
shake += 'Authorization: %s\r\n' % auth
......@@ -351,7 +353,6 @@ class websocket(object):
self.handshake_started = True
receive_response(send_request(location))
def enable_ssl(self, *args, **kwargs):
"""
Transforms the regular socket.socket to an ssl.SSLSocket for secure
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment