Restore Flake8 CI checks
MODIFY
_travis/install.sh
_travis/install.sh
@@ -7,9 +7,6 @@ if [[ "$(uname -s)" == 'Darwin' ]]; then
sw_vers
brew update || brew update
- # https://github.com/travis-ci/travis-ci/issues/8826
- brew cask uninstall oclint
-
brew outdated openssl || brew upgrade openssl
brew install openssl@1.1

MODIFY
setup.cfg
setup.cfg
[flake8]
-exclude=./docs/conf.py,./urllib3/packages/*
+exclude=./docs/conf.py,./src/urllib3/packages/*
max-line-length=99
[bdist_wheel]

MODIFY
src/urllib3/connection.py
src/urllib3/connection.py
@@ -158,7 +158,7 @@ class HTTPConnection(_HTTPConnection, object):
conn = connection.create_connection(
(self._dns_host, self.port), self.timeout, **extra_kw)
- except SocketTimeout as e:
+ except SocketTimeout:
raise ConnectTimeoutError(
self, "Connection to %s timed out. (connect timeout=%s)" %
(self.host, self.timeout))

MODIFY
src/urllib3/connectionpool.py
src/urllib3/connectionpool.py
@@ -672,7 +672,7 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
# released back to the pool once the entire response is read
response.read()
except (TimeoutError, HTTPException, SocketError, ProtocolError,
- BaseSSLError, SSLError) as e:
+ BaseSSLError, SSLError):
pass
# Handle redirect?

MODIFY
src/urllib3/contrib/pyopenssl.py
src/urllib3/contrib/pyopenssl.py
@@ -276,7 +276,7 @@ class WrappedSocket(object):
return b''
else:
raise SocketError(str(e))
- except OpenSSL.SSL.ZeroReturnError as e:
+ except OpenSSL.SSL.ZeroReturnError:
if self.connection.get_shutdown() == OpenSSL.SSL.RECEIVED_SHUTDOWN:
return b''
else:
@@ -297,7 +297,7 @@ class WrappedSocket(object):
return 0
else:
raise SocketError(str(e))
- except OpenSSL.SSL.ZeroReturnError as e:
+ except OpenSSL.SSL.ZeroReturnError:
if self.connection.get_shutdown() == OpenSSL.SSL.RECEIVED_SHUTDOWN:
return 0
else:

MODIFY
src/urllib3/contrib/socks.py
src/urllib3/contrib/socks.py
@@ -88,7 +88,7 @@ class SOCKSConnection(HTTPConnection):
**extra_kw
)
- except SocketTimeout as e:
+ except SocketTimeout:
raise ConnectTimeoutError(
self, "Connection to %s timed out. (connect timeout=%s)" %
(self.host, self.timeout))

MODIFY
src/urllib3/response.py
src/urllib3/response.py
@@ -311,7 +311,9 @@ class HTTPResponse(io.IOBase):
if content_encoding in self.CONTENT_DECODERS:
self._decoder = _get_decoder(content_encoding)
elif ',' in content_encoding:
- encodings = [e.strip() for e in content_encoding.split(',') if e.strip() in self.CONTENT_DECODERS]
+ encodings = [
+ e.strip() for e in content_encoding.split(',')
+ if e.strip() in self.CONTENT_DECODERS]
if len(encodings):
self._decoder = _get_decoder(content_encoding)

MODIFY
src/urllib3/util/ssl_.py
src/urllib3/util/ssl_.py
@@ -112,8 +112,6 @@ DEFAULT_CIPHERS = ':'.join([
try:
from ssl import SSLContext # Modern SSL?
except ImportError:
- import sys
-
class SSLContext(object): # Platform-specific: Python 2
def __init__(self, protocol_version):
self.protocol = protocol_version

MODIFY
tox.ini
tox.ini
@@ -36,7 +36,7 @@ deps=
flake8
commands=
flake8 --version
- flake8 setup.py docs dummyserver urllib3 test
+ flake8 setup.py docs dummyserver src test
[testenv:docs]
basepython = python2.7

Restore Flake8 CI checks (#1477)