mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2025-08-14 18:58:10 +08:00
Fix #1262: Remove __init__ in models protocols to fix typing error with Pylance
This commit is contained in:
@ -13,9 +13,6 @@ class UserProtocol(Protocol[ID]):
|
|||||||
is_superuser: bool
|
is_superuser: bool
|
||||||
is_verified: bool
|
is_verified: bool
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs) -> None:
|
|
||||||
... # pragma: no cover
|
|
||||||
|
|
||||||
|
|
||||||
class OAuthAccountProtocol(Protocol[ID]):
|
class OAuthAccountProtocol(Protocol[ID]):
|
||||||
"""OAuth account protocol that ORM model should follow."""
|
"""OAuth account protocol that ORM model should follow."""
|
||||||
@ -28,9 +25,6 @@ class OAuthAccountProtocol(Protocol[ID]):
|
|||||||
account_id: str
|
account_id: str
|
||||||
account_email: str
|
account_email: str
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs) -> None:
|
|
||||||
... # pragma: no cover
|
|
||||||
|
|
||||||
|
|
||||||
UP = TypeVar("UP", bound=UserProtocol)
|
UP = TypeVar("UP", bound=UserProtocol)
|
||||||
OAP = TypeVar("OAP", bound=OAuthAccountProtocol)
|
OAP = TypeVar("OAP", bound=OAuthAccountProtocol)
|
||||||
@ -39,6 +33,12 @@ OAP = TypeVar("OAP", bound=OAuthAccountProtocol)
|
|||||||
class UserOAuthProtocol(UserProtocol[ID], Generic[ID, OAP]):
|
class UserOAuthProtocol(UserProtocol[ID], Generic[ID, OAP]):
|
||||||
"""User protocol including a list of OAuth accounts."""
|
"""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]
|
oauth_accounts: List[OAP]
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user