Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /fastapi-users_fastapi-users /fastapi_users /schemas.py
| from typing import Generic, TypeVar | |
| from pydantic import BaseModel, ConfigDict, EmailStr | |
| from fastapi_users import models | |
| SCHEMA = TypeVar("SCHEMA", bound=BaseModel) | |
| class CreateUpdateDictModel(BaseModel): | |
| def create_update_dict(self): | |
| return self.model_dump( | |
| exclude_unset=True, | |
| exclude={ | |
| "id", | |
| "is_superuser", | |
| "is_active", | |
| "is_verified", | |
| "oauth_accounts", | |
| }, | |
| ) | |
| def create_update_dict_superuser(self): | |
| return self.model_dump(exclude_unset=True, exclude={"id"}) | |
| class BaseUser(CreateUpdateDictModel, Generic[models.ID]): | |
| """Base User model.""" | |
| id: models.ID | |
| email: EmailStr | |
| is_active: bool = True | |
| is_superuser: bool = False | |
| is_verified: bool = False | |
| model_config = ConfigDict(from_attributes=True) | |
| class BaseUserCreate(CreateUpdateDictModel): | |
| email: EmailStr | |
| password: str | |
| is_active: bool | None = True | |
| is_superuser: bool | None = False | |
| is_verified: bool | None = False | |
| class BaseUserUpdate(CreateUpdateDictModel): | |
| password: str | None = None | |
| email: EmailStr | None = None | |
| is_active: bool | None = None | |
| is_superuser: bool | None = None | |
| is_verified: bool | None = None | |
| U = TypeVar("U", bound=BaseUser) | |
| UC = TypeVar("UC", bound=BaseUserCreate) | |
| UU = TypeVar("UU", bound=BaseUserUpdate) | |
| class BaseOAuthAccount(BaseModel, Generic[models.ID]): | |
| """Base OAuth account model.""" | |
| id: models.ID | |
| oauth_name: str | |
| access_token: str | |
| expires_at: int | None = None | |
| refresh_token: str | None = None | |
| account_id: str | |
| account_email: str | |
| model_config = ConfigDict(from_attributes=True) | |
| class BaseOAuthAccountMixin(BaseModel): | |
| """Adds OAuth accounts list to a User model.""" | |
| oauth_accounts: list[BaseOAuthAccount] = [] | |
Xet Storage Details
- Size:
- 1.88 kB
- Xet hash:
- d6e1d9056eee96316a26dfcee1feaa3bb06b08c4fb9743e3130fa83f3d5c4db8
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.