From f63134bacf3017bada3cba4462ce794ca79a38b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Voron?= Date: Mon, 2 May 2022 17:59:45 +0200 Subject: [PATCH] Tweak base DB typing --- fastapi_users/db/base.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/fastapi_users/db/base.py b/fastapi_users/db/base.py index 681bad92..5c0b675c 100644 --- a/fastapi_users/db/base.py +++ b/fastapi_users/db/base.py @@ -1,6 +1,6 @@ from typing import Any, Dict, Generic, Optional -from fastapi_users.models import ID, OAP, UP +from fastapi_users.models import ID, OAP, UOAP, UP from fastapi_users.types import DependencyCallable @@ -31,13 +31,18 @@ class BaseUserDatabase(Generic[UP, ID]): """Delete a user.""" raise NotImplementedError() - async def add_oauth_account(self, user: UP, create_dict: Dict[str, Any]) -> UP: + async def add_oauth_account( + self: "BaseUserDatabase[UOAP, ID]", user: UOAP, create_dict: Dict[str, Any] + ) -> UOAP: """Create an OAuth account and add it to the user.""" raise NotImplementedError() async def update_oauth_account( - self, user: UP, oauth_account: OAP, update_dict: Dict[str, Any] - ) -> UP: + self: "BaseUserDatabase[UOAP, ID]", + user: UOAP, + oauth_account: OAP, + update_dict: Dict[str, Any], + ) -> UOAP: """Update an OAuth account on a user.""" raise NotImplementedError()