From 5db7542aeb3da6dc53d183975c418dd7db3124ec Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Tue, 23 May 2023 14:03:50 -0400 Subject: [PATCH] style: Fix various pylint violations. --- edx_rest_framework_extensions/auth/jwt/authentication.py | 2 +- edx_rest_framework_extensions/auth/jwt/middleware.py | 6 +++++- edx_rest_framework_extensions/middleware.py | 1 - 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/edx_rest_framework_extensions/auth/jwt/authentication.py b/edx_rest_framework_extensions/auth/jwt/authentication.py index b2732f2a..9d3d48a4 100644 --- a/edx_rest_framework_extensions/auth/jwt/authentication.py +++ b/edx_rest_framework_extensions/auth/jwt/authentication.py @@ -8,8 +8,8 @@ from rest_framework import exceptions from rest_framework_jwt.authentication import JSONWebTokenAuthentication -from edx_rest_framework_extensions.auth.jwt.cookies import jwt_cookie_name from edx_rest_framework_extensions.auth.jwt.constants import USE_JWT_COOKIE_HEADER +from edx_rest_framework_extensions.auth.jwt.cookies import jwt_cookie_name from edx_rest_framework_extensions.auth.jwt.decoder import configured_jwt_decode_handler from edx_rest_framework_extensions.config import ENABLE_FORGIVING_JWT_COOKIES from edx_rest_framework_extensions.settings import get_setting diff --git a/edx_rest_framework_extensions/auth/jwt/middleware.py b/edx_rest_framework_extensions/auth/jwt/middleware.py index c2c31076..5e2dec2c 100644 --- a/edx_rest_framework_extensions/auth/jwt/middleware.py +++ b/edx_rest_framework_extensions/auth/jwt/middleware.py @@ -23,7 +23,10 @@ jwt_cookie_name, jwt_cookie_signature_name, ) -from edx_rest_framework_extensions.config import ENABLE_FORGIVING_JWT_COOKIES, ENABLE_SET_REQUEST_USER_FOR_JWT_COOKIE +from edx_rest_framework_extensions.config import ( + ENABLE_FORGIVING_JWT_COOKIES, + ENABLE_SET_REQUEST_USER_FOR_JWT_COOKIE, +) from edx_rest_framework_extensions.permissions import ( LoginRedirectIfUnauthenticated, NotJwtRestrictedApplication, @@ -305,6 +308,7 @@ def _process_view_forgiving_jwt_cookies(self, request, view_func): # For more info, see https://github.com/jpadilla/django-rest-framework-jwt/issues/45#issuecomment-74996698 request.user = SimpleLazyObject(lambda: _get_user_from_jwt(request, view_func)) + def _get_user_from_jwt(request, view_func): user = get_user(request) if user.is_authenticated: diff --git a/edx_rest_framework_extensions/middleware.py b/edx_rest_framework_extensions/middleware.py index 8b502752..b1b47376 100644 --- a/edx_rest_framework_extensions/middleware.py +++ b/edx_rest_framework_extensions/middleware.py @@ -8,7 +8,6 @@ from edx_django_utils.cache import DEFAULT_REQUEST_CACHE import edx_rest_framework_extensions -from edx_rest_framework_extensions.auth.jwt.constants import USE_JWT_COOKIE_HEADER from edx_rest_framework_extensions.auth.jwt.cookies import jwt_cookie_name