Improve generic typing

This commit is contained in:
François Voron
2021-09-14 11:53:43 +02:00
parent 90aee2d487
commit fdc8e54253
15 changed files with 60 additions and 61 deletions

View File

@ -3,8 +3,8 @@ from typing import Any, Generic, Optional, TypeVar
from fastapi import Response
from fastapi.security.base import SecurityBase
from fastapi_users import models
from fastapi_users.manager import UserManager
from fastapi_users.models import BaseUserDB
T = TypeVar("T")
@ -28,12 +28,12 @@ class BaseAuthentication(Generic[T]):
self.logout = logout
async def __call__(
self, credentials: Optional[T], user_manager: UserManager
) -> Optional[BaseUserDB]:
self, credentials: Optional[T], user_manager: UserManager[models.UD]
) -> Optional[models.UD]:
raise NotImplementedError()
async def get_login_response(self, user: BaseUserDB, response: Response) -> Any:
async def get_login_response(self, user: models.UD, response: Response) -> Any:
raise NotImplementedError()
async def get_logout_response(self, user: BaseUserDB, response: Response) -> Any:
async def get_logout_response(self, user: models.UD, response: Response) -> Any:
raise NotImplementedError()