summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Pradet <quentin@pradet.me>2018-11-19 20:39:41 +0400
committerSeth M. Larson <sethmichaellarson@gmail.com>2018-11-19 10:39:41 -0600
commitd0255e01b616f02b45eb207459937a9666e13af6 (patch)
treec1bed98eece5d57cd51c61ce7a89e81a8e5413d2
parent0cedb3b0f1e5d79c89c6db767c534b064b794cf2 (diff)
downloadurllib3-d0255e01b616f02b45eb207459937a9666e13af6.tar.gz
Restore Flake8 CI checks (#1477)
-rwxr-xr-x_travis/install.sh3
-rw-r--r--setup.cfg2
-rw-r--r--src/urllib3/connection.py2
-rw-r--r--src/urllib3/connectionpool.py2
-rw-r--r--src/urllib3/contrib/pyopenssl.py4
-rw-r--r--src/urllib3/contrib/socks.py2
-rw-r--r--src/urllib3/poolmanager.py2
-rw-r--r--src/urllib3/response.py4
-rw-r--r--src/urllib3/util/ssl_.py2
-rw-r--r--tox.ini2
10 files changed, 11 insertions, 14 deletions
diff --git a/_travis/install.sh b/_travis/install.sh
index 85881a0f..76bd226b 100755
--- a/_travis/install.sh
+++ b/_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
diff --git a/setup.cfg b/setup.cfg
index efb26b86..33b68d08 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,5 @@
[flake8]
-exclude=./docs/conf.py,./urllib3/packages/*
+exclude=./docs/conf.py,./src/urllib3/packages/*
max-line-length=99
[bdist_wheel]
diff --git a/src/urllib3/connection.py b/src/urllib3/connection.py
index 02b36654..ba269b7a 100644
--- a/src/urllib3/connection.py
+++ b/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))
diff --git a/src/urllib3/connectionpool.py b/src/urllib3/connectionpool.py
index f7a8f193..d65581ee 100644
--- a/src/urllib3/connectionpool.py
+++ b/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?
diff --git a/src/urllib3/contrib/pyopenssl.py b/src/urllib3/contrib/pyopenssl.py
index 7c0e9465..539bf8a8 100644
--- a/src/urllib3/contrib/pyopenssl.py
+++ b/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:
diff --git a/src/urllib3/contrib/socks.py b/src/urllib3/contrib/socks.py
index 811e312e..532d99ce 100644
--- a/src/urllib3/contrib/socks.py
+++ b/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))
diff --git a/src/urllib3/poolmanager.py b/src/urllib3/poolmanager.py
index fe5491cf..70393249 100644
--- a/src/urllib3/poolmanager.py
+++ b/src/urllib3/poolmanager.py
@@ -47,7 +47,7 @@ _key_fields = (
'key__socks_options', # dict
'key_assert_hostname', # bool or string
'key_assert_fingerprint', # str
- 'key_server_hostname', #str
+ 'key_server_hostname', # str
)
#: The namedtuple class used to construct keys for the connection pool.
diff --git a/src/urllib3/response.py b/src/urllib3/response.py
index c112690b..97cdfd13 100644
--- a/src/urllib3/response.py
+++ b/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)
diff --git a/src/urllib3/util/ssl_.py b/src/urllib3/util/ssl_.py
index 64ea192a..00a6fdf8 100644
--- a/src/urllib3/util/ssl_.py
+++ b/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
diff --git a/tox.ini b/tox.ini
index 5f65ab9f..086c40d8 100644
--- a/tox.ini
+++ b/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