lint(minor): fix all remaining pylint and prospector errors
This commit is contained in:
parent
84768c0ec6
commit
7bff2734aa
|
@ -204,8 +204,8 @@ class RequestHandler:
|
|||
def _set_content_type(self, proxy_response):
|
||||
content_type = proxy_response.headers.get('Content-Type')
|
||||
if not content_type:
|
||||
content_type = (mimetypes.guess_type(self.request.path)[0] or
|
||||
self.app_gw.default_content_type)
|
||||
content_type = (mimetypes.guess_type(self.request.path)
|
||||
[0] or self.app_gw.default_content_type)
|
||||
proxy_response.headers['Content-Type'] = content_type
|
||||
# LOGGER.debug("Proxy response CONTENT-TYPE: %s",
|
||||
# proxy_response.headers['Content-Type'])
|
||||
|
|
|
@ -77,7 +77,7 @@ class TestFactorAuthentication(TestCase):
|
|||
request.user = AnonymousUser()
|
||||
middleware = SessionMiddleware()
|
||||
middleware.process_request(request)
|
||||
request.session.save()
|
||||
request.session.save() # pylint: disable=no-member
|
||||
request.session[AuthenticationView.SESSION_PENDING_USER] = self.user.pk
|
||||
|
||||
response = AuthenticationView.as_view()(request)
|
||||
|
@ -93,7 +93,7 @@ class TestFactorAuthentication(TestCase):
|
|||
request.user = AnonymousUser()
|
||||
middleware = SessionMiddleware()
|
||||
middleware.process_request(request)
|
||||
request.session.save()
|
||||
request.session.save() # pylint: disable=no-member
|
||||
request.session[AuthenticationView.SESSION_PENDING_USER] = self.user.pk
|
||||
|
||||
response = AuthenticationView.as_view()(request)
|
||||
|
@ -111,7 +111,7 @@ class TestFactorAuthentication(TestCase):
|
|||
request.user = AnonymousUser()
|
||||
middleware = SessionMiddleware()
|
||||
middleware.process_request(request)
|
||||
request.session.save()
|
||||
request.session.save() # pylint: disable=no-member
|
||||
request.session[AuthenticationView.SESSION_PENDING_USER] = self.user.pk
|
||||
|
||||
response = AuthenticationView.as_view()(request)
|
||||
|
@ -127,7 +127,7 @@ class TestFactorAuthentication(TestCase):
|
|||
middleware.process_request(request)
|
||||
for key, value in session_copy:
|
||||
request.session[key] = value
|
||||
request.session.save()
|
||||
request.session.save() # pylint: disable=no-member
|
||||
response = AuthenticationView.as_view()(request)
|
||||
self.assertEqual(response.status_code, 302)
|
||||
self.assertEqual(response.url, reverse('passbook_core:overview'))
|
||||
|
|
|
@ -143,9 +143,6 @@ class ConfigLoader:
|
|||
|
||||
CONFIG = ConfigLoader()
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
|
||||
|
||||
def signal_handler(sender, **_):
|
||||
"""Add all loaded config files to autoreload watcher"""
|
||||
for path in CONFIG.loaded_file:
|
||||
|
|
|
@ -32,8 +32,7 @@ def reauth_required(view_function):
|
|||
|
||||
if RE_AUTH_KEY not in request.session:
|
||||
# Timestamp not in session, force user to reauth
|
||||
return redirect(reverse('account-reauth') + '?' +
|
||||
urlencode({'next': request.path}))
|
||||
return redirect(reverse('account-reauth') + '?' + urlencode({'next': request.path}))
|
||||
|
||||
if RE_AUTH_KEY in request.session and \
|
||||
request.session[RE_AUTH_KEY] >= (now - RE_AUTH_MARGAIN) and \
|
||||
|
|
|
@ -120,9 +120,9 @@ class OAuthClient(BaseOAuthClient):
|
|||
"Parse token and secret from raw token response."
|
||||
if raw_token is None:
|
||||
return (None, None)
|
||||
qs = parse_qs(raw_token)
|
||||
token = qs.get('oauth_token', [None])[0]
|
||||
secret = qs.get('oauth_token_secret', [None])[0]
|
||||
query_string = parse_qs(raw_token)
|
||||
token = query_string.get('oauth_token', [None])[0]
|
||||
secret = query_string.get('oauth_token_secret', [None])[0]
|
||||
return (token, secret)
|
||||
|
||||
def request(self, method, url, **kwargs):
|
||||
|
@ -217,8 +217,7 @@ class OAuth2Client(BaseOAuthClient):
|
|||
try:
|
||||
token_data = json.loads(raw_token)
|
||||
except ValueError:
|
||||
qs = parse_qs(raw_token)
|
||||
token = qs.get('access_token', [None])[0]
|
||||
token = parse_qs(raw_token).get('access_token', [None])[0]
|
||||
else:
|
||||
token = token_data.get('access_token', None)
|
||||
return (token, None)
|
||||
|
|
Reference in New Issue