Lint fix.
diff --git a/google/auth/_oauth2client.py b/google/auth/_oauth2client.py
index e298fb1..71fd7bf 100644
--- a/google/auth/_oauth2client.py
+++ b/google/auth/_oauth2client.py
@@ -21,19 +21,20 @@
from __future__ import absolute_import
+import six
+
from google.auth import _helpers
import google.auth.app_engine
import google.oauth2.credentials
import google.oauth2.service_account
-import six
try:
import oauth2client.client
import oauth2client.contrib.gce
import oauth2client.service_account
except ImportError as caught_exc:
- new_exc = ImportError('oauth2client is not installed.')
- six.raise_from(new_exc, caught_exc)
+ six.raise_from(
+ ImportError('oauth2client is not installed.'), caught_exc)
try:
import oauth2client.contrib.appengine
diff --git a/google/auth/transport/grpc.py b/google/auth/transport/grpc.py
index 08b2f57..0d44f64 100644
--- a/google/auth/transport/grpc.py
+++ b/google/auth/transport/grpc.py
@@ -20,10 +20,13 @@
try:
import grpc
except ImportError as caught_exc: # pragma: NO COVER
- new_exc = ImportError(
- 'gRPC is not installed, please install the grpcio package to use the '
- 'gRPC transport.')
- six.raise_from(new_exc, caught_exc)
+ six.raise_from(
+ ImportError(
+ 'gRPC is not installed, please install the grpcio package '
+ 'to use the gRPC transport.'
+ ),
+ caught_exc,
+ )
class AuthMetadataPlugin(grpc.AuthMetadataPlugin):
diff --git a/google/auth/transport/requests.py b/google/auth/transport/requests.py
index 31ce22d..66ff0d3 100644
--- a/google/auth/transport/requests.py
+++ b/google/auth/transport/requests.py
@@ -18,15 +18,19 @@
import logging
-import six
try:
import requests
except ImportError as caught_exc: # pragma: NO COVER
- new_exc = ImportError(
- 'The requests library is not installed, please install the requests '
- 'package to use the requests transport.')
- six.raise_from(new_exc, caught_exc)
-import requests.exceptions
+ import six
+ six.raise_from(
+ ImportError(
+ 'The requests library is not installed, please install the '
+ 'requests package to use the requests transport.'
+ ),
+ caught_exc,
+ )
+import requests.exceptions # pylint: disable=ungrouped-imports
+import six # pylint: disable=ungrouped-imports
from google.auth import exceptions
from google.auth import transport
diff --git a/google/auth/transport/urllib3.py b/google/auth/transport/urllib3.py
index 872bf9f..ec20fb6 100644
--- a/google/auth/transport/urllib3.py
+++ b/google/auth/transport/urllib3.py
@@ -30,15 +30,19 @@
except ImportError: # pragma: NO COVER
certifi = None
-import six
try:
import urllib3
except ImportError as caught_exc: # pragma: NO COVER
- new_exc = ImportError(
- 'The urllib3 library is not installed, please install the urllib3 '
- 'package to use the urllib3 transport.')
- six.raise_from(new_exc, caught_exc)
-import urllib3.exceptions
+ import six
+ six.raise_from(
+ ImportError(
+ 'The urllib3 library is not installed, please install the '
+ 'urllib3 package to use the urllib3 transport.'
+ ),
+ caught_exc,
+ )
+import six
+import urllib3.exceptions # pylint: disable=ungrouped-imports
from google.auth import exceptions
from google.auth import transport
diff --git a/tests/compute_engine/test_credentials.py b/tests/compute_engine/test_credentials.py
index ee343fe..c78511b 100644
--- a/tests/compute_engine/test_credentials.py
+++ b/tests/compute_engine/test_credentials.py
@@ -75,7 +75,7 @@
def test_refresh_error(self, get):
get.side_effect = exceptions.TransportError('http error')
- with pytest.raises(exceptions.RefreshError) as excinfo:
+ with pytest.raises(exceptions.RefreshError):
self.credentials.refresh(None)
@mock.patch('google.auth.compute_engine._metadata.get', autospec=True)