From 54590167a6465b4c3fa70a7897f68c9e9eadbff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Voron?= Date: Tue, 8 Aug 2023 11:40:20 +0200 Subject: [PATCH] Fix #1262: Remove __init__ in models protocols to fix typing error with Pylance --- fastapi_users/models.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fastapi_users/models.py b/fastapi_users/models.py index ed02632d..b65b64bd 100644 --- a/fastapi_users/models.py +++ b/fastapi_users/models.py @@ -13,9 +13,6 @@ class UserProtocol(Protocol[ID]): is_superuser: bool is_verified: bool - def __init__(self, *args, **kwargs) -> None: - ... # pragma: no cover - class OAuthAccountProtocol(Protocol[ID]): """OAuth account protocol that ORM model should follow.""" @@ -28,9 +25,6 @@ class OAuthAccountProtocol(Protocol[ID]): account_id: str account_email: str - def __init__(self, *args, **kwargs) -> None: - ... # pragma: no cover - UP = TypeVar("UP", bound=UserProtocol) OAP = TypeVar("OAP", bound=OAuthAccountProtocol) @@ -39,6 +33,12 @@ OAP = TypeVar("OAP", bound=OAuthAccountProtocol) class UserOAuthProtocol(UserProtocol[ID], Generic[ID, OAP]): """User protocol including a list of OAuth accounts.""" + id: ID + email: str + hashed_password: str + is_active: bool + is_superuser: bool + is_verified: bool oauth_accounts: List[OAP]