Commit 8128847f authored by Jason Madden's avatar Jason Madden

Lint.

parent 88433c29
......@@ -200,8 +200,7 @@ class SSLSocket(socket):
if self._sslobj:
raise ValueError("sendto not allowed on instances of %s" %
self.__class__)
else:
return socket.sendto(self, *args)
return socket.sendto(self, *args)
def recv(self, buflen=1024, flags=0):
if self._sslobj:
......@@ -245,15 +244,13 @@ class SSLSocket(socket):
if self._sslobj:
raise ValueError("recvfrom not allowed on instances of %s" %
self.__class__)
else:
return socket.recvfrom(self, *args)
return socket.recvfrom(self, *args)
def recvfrom_into(self, *args):
if self._sslobj:
raise ValueError("recvfrom_into not allowed on instances of %s" %
self.__class__)
else:
return socket.recvfrom_into(self, *args)
return socket.recvfrom_into(self, *args)
def pending(self):
if self._sslobj:
......
......@@ -450,10 +450,9 @@ class SSLSocket(socket):
if self._sslobj:
raise ValueError("sendto not allowed on instances of %s" %
self.__class__)
elif addr is None:
if addr is None:
return socket.sendto(self, data, flags_or_addr)
else:
return socket.sendto(self, data, flags_or_addr, addr)
return socket.sendto(self, data, flags_or_addr, addr)
def sendmsg(self, *args, **kwargs):
# Ensure programs don't send data unencrypted if they try to
......@@ -508,16 +507,14 @@ class SSLSocket(socket):
if self._sslobj:
raise ValueError("recvfrom not allowed on instances of %s" %
self.__class__)
else:
return socket.recvfrom(self, buflen, flags)
return socket.recvfrom(self, buflen, flags)
def recvfrom_into(self, buffer, nbytes=None, flags=0):
self._checkClosed()
if self._sslobj:
raise ValueError("recvfrom_into not allowed on instances of %s" %
self.__class__)
else:
return socket.recvfrom_into(self, buffer, nbytes, flags)
return socket.recvfrom_into(self, buffer, nbytes, flags)
def recvmsg(self, *args, **kwargs):
raise NotImplementedError("recvmsg not allowed on instances of %s" %
......
......@@ -420,10 +420,9 @@ class SSLSocket(socket):
if self._sslobj:
raise ValueError("sendto not allowed on instances of %s" %
self.__class__)
elif addr is None:
if addr is None:
return socket.sendto(self, data, flags_or_addr)
else:
return socket.sendto(self, data, flags_or_addr, addr)
return socket.sendto(self, data, flags_or_addr, addr)
def sendmsg(self, *args, **kwargs):
# Ensure programs don't send data unencrypted if they try to
......@@ -485,8 +484,7 @@ class SSLSocket(socket):
if self._sslobj:
raise ValueError("recvfrom_into not allowed on instances of %s" %
self.__class__)
else:
return socket.recvfrom_into(self, buffer, nbytes, flags)
return socket.recvfrom_into(self, buffer, nbytes, flags)
def recvmsg(self, *args, **kwargs):
raise NotImplementedError("recvmsg not allowed on instances of %s" %
......
......@@ -50,8 +50,7 @@ def _lookup_port(port, socktype):
except error as ex:
if 'not found' in str(ex):
raise gaierror(EAI_SERVICE, 'Servname not supported for ai_socktype')
else:
raise gaierror(str(ex))
raise gaierror(str(ex))
except UnicodeEncodeError:
raise error('Int or String expected', port)
elif port is None:
......
......@@ -1464,7 +1464,7 @@ class Handler(pywsgi.WSGIHandler):
def read_requestline(self):
data = self.rfile.read(7)
if data[0] == b'<'[0]:
if data[0] == b'<'[0]: # py3: indexing bytes returns ints. sigh.
# Returning nothing stops handle_one_request()
# Note that closing or even deleting self.socket() here
# can lead to the read side throwing Connection Reset By Peer,
......@@ -1475,8 +1475,7 @@ class Handler(pywsgi.WSGIHandler):
else:
self.log_error('Invalid request: %r', data)
return None
else:
return data + self.rfile.readline()
return data + self.rfile.readline()
class TestHandlerSubclass(TestCase):
......
......@@ -75,8 +75,7 @@ def handle_request(s, raise_on_timeout):
except socket.timeout:
if raise_on_timeout:
raise
else:
return
return
#print('handle_request - accepted')
res = conn.recv(100)
assert res == b'hello', repr(res)
......
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