Download api/app/user/validator.py from iBrokeTheCode/Image_Classifier_with_CNN: direct link, hf CLI and curl.
- Browser
- Download file 771 Bytes
-
https://huggingface.co/spaces/iBrokeTheCode/Image_Classifier_with_CNN/resolve/3ce4bfcd092cc1d5f518baf6ca367ffa336d7d75/api/app/user/validator.py
- Command line
-
hf download hf://spaces/iBrokeTheCode/Image_Classifier_with_CNN@3ce4bfcd092cc1d5f518baf6ca367ffa336d7d75/api/app/user/validator.py
-
curl -L -o validator.py https://huggingface.co/spaces/iBrokeTheCode/Image_Classifier_with_CNN/resolve/3ce4bfcd092cc1d5f518baf6ca367ffa336d7d75/api/app/user/validator.py
771 Bytes
| from typing import Optional | |
| from sqlalchemy.orm import Session | |
| from .models import User | |
| async def verify_email_exist(email: str, database: Session) -> Optional[User]: | |
| """ | |
| Checks if a user with the specified email exists in the database. | |
| This asynchronous function queries the database to find a user with the given email. | |
| It returns the user object if found, or `None` if no user with that email exists. | |
| Args: | |
| email (str): The email address to check for existence. | |
| database (Session): The database session used for querying the database. | |
| Returns: | |
| Optional[User]: The user object if a user with the specified email exists, otherwise `None`. | |
| """ | |
| return database.query(User).filter(User.email == email).first() | |