Files
2022-04-29 13:49:21 +02:00

45 lines
977 B
Python

import sys
import uuid
from typing import Generic, List, Optional, TypeVar
if sys.version_info < (3, 8):
from typing_extensions import Protocol # pragma: no cover
else:
from typing import Protocol # pragma: no cover
class UserProtocol(Protocol):
id: uuid.UUID
email: str
hashed_password: str
is_active: bool
is_superuser: bool
is_verified: bool
def __init__(self, *args, **kwargs) -> None:
... # pragma: no cover
class OAuthAccountProtocol(Protocol):
id: uuid.UUID
oauth_name: str
access_token: str
expires_at: Optional[int]
refresh_token: Optional[str]
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)
class UserOAuthProtocol(UserProtocol, Generic[OAP]):
oauth_accounts: List[OAP]
UOAP = TypeVar("UOAP", bound=UserOAuthProtocol)