Skip to content

Commit 00de028

Browse files
Repair the type annotations in the TokenViewBase class. (#880)
* Repair the type annotations in the TokenViewBase class. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Ah, python3.9 did support parameterizing the 'type' type. I wasn't sure. So we don't need the Type from typing. * The abstract type is BaseSerializer, not Serializer --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent efb105e commit 00de028

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

rest_framework_simplejwt/views.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
from typing import Optional
2+
13
from django.utils.module_loading import import_string
24
from rest_framework import generics, status
35
from rest_framework.request import Request
46
from rest_framework.response import Response
5-
from rest_framework.serializers import Serializer
7+
from rest_framework.serializers import BaseSerializer
68

79
from .authentication import AUTH_HEADER_TYPES
810
from .exceptions import InvalidToken, TokenError
@@ -13,12 +15,12 @@ class TokenViewBase(generics.GenericAPIView):
1315
permission_classes = ()
1416
authentication_classes = ()
1517

16-
serializer_class = None
18+
serializer_class: Optional[type[BaseSerializer]] = None
1719
_serializer_class = ""
1820

1921
www_authenticate_realm = "api"
2022

21-
def get_serializer_class(self) -> Serializer:
23+
def get_serializer_class(self) -> type[BaseSerializer]:
2224
"""
2325
If serializer_class is set, use it directly. Otherwise get the class from settings.
2426
"""

0 commit comments

Comments
 (0)