From 310fab75b01c2ebf6a1e70b082f434f0c155ff56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petra=20C=CC=8Ci=CC=81halova=CC=81?= Date: Fri, 13 Oct 2023 21:59:38 +0200 Subject: [PATCH 1/4] refactor: removed unused variable in the custom_exception_handler() --- rbac/api/common/exception_handler.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rbac/api/common/exception_handler.py b/rbac/api/common/exception_handler.py index 28f95d54d..2e270e21d 100644 --- a/rbac/api/common/exception_handler.py +++ b/rbac/api/common/exception_handler.py @@ -73,7 +73,6 @@ def custom_exception_handler(exc, context): error_response = {"errors": errors} response.data = error_response elif isinstance(exc, IntegrityError): - data = context.get("request").data source_view = context.get("view") response = Response( { From f41326d8202e8f7f6be014b99e906201e5b8c490 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petra=20C=CC=8Ci=CC=81halova=CC=81?= Date: Fri, 13 Oct 2023 22:01:42 +0200 Subject: [PATCH 2/4] refactor: unused value of decoded_rh_auth variable --- rbac/api/serializers.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rbac/api/serializers.py b/rbac/api/serializers.py index df6cea881..efc63787b 100644 --- a/rbac/api/serializers.py +++ b/rbac/api/serializers.py @@ -55,7 +55,6 @@ def extract_header(request, header): Decoded(dict): Identity dictionary """ rh_auth_header = request.META[header] - decoded_rh_auth = None try: decoded_rh_auth = b64decode(rh_auth_header) except binascii.Error as err: From d938e9d58fdbbb4ba9f865fb3060fe70a6db757c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petra=20C=CC=8Ci=CC=81halova=CC=81?= Date: Fri, 13 Oct 2023 22:02:23 +0200 Subject: [PATCH 3/4] refactor: removed not needed parentheses --- rbac/api/serializers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rbac/api/serializers.py b/rbac/api/serializers.py index efc63787b..3939c8171 100644 --- a/rbac/api/serializers.py +++ b/rbac/api/serializers.py @@ -64,7 +64,7 @@ def extract_header(request, header): rh_auth_header = add_padding(rh_auth_header) decoded_rh_auth = b64decode(rh_auth_header) json_rh_auth = json_loads(decoded_rh_auth) - return (rh_auth_header, json_rh_auth) + return rh_auth_header, json_rh_auth def create_tenant_name(account): From 7dcf4c6045f583d383d11d8a802b391a1f6ab9ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petra=20C=CC=8Ci=CC=81halova=CC=81?= Date: Fri, 13 Oct 2023 22:02:57 +0200 Subject: [PATCH 4/4] refactor: removed unreachable code --- rbac/api/openapi/view.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rbac/api/openapi/view.py b/rbac/api/openapi/view.py index c17495d33..2d99f38d5 100644 --- a/rbac/api/openapi/view.py +++ b/rbac/api/openapi/view.py @@ -19,7 +19,7 @@ import gzip import json -from rest_framework import permissions, status +from rest_framework import permissions from rest_framework.decorators import api_view, permission_classes, renderer_classes from rest_framework.renderers import JSONRenderer from rest_framework.response import Response @@ -38,4 +38,3 @@ def openapi(request): with gzip.open(openapidoc) as api_file: data = json.load(api_file) return Response(data) - return Response(status=status.HTTP_404_NOT_FOUND)