From b46f3fb0fd2d05fef0d32bd3136faed56e9933b7 Mon Sep 17 00:00:00 2001 From: profitroll Date: Thu, 22 Jun 2023 13:26:01 +0200 Subject: [PATCH] Imports cleanup --- extensions/exceptions.py | 16 +++++++++++++++- extensions/photos.py | 30 ++++++++++++++++++------------ extensions/videos.py | 1 - 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/extensions/exceptions.py b/extensions/exceptions.py index 613310b..d8e7364 100644 --- a/extensions/exceptions.py +++ b/extensions/exceptions.py @@ -9,7 +9,21 @@ from starlette.status import ( HTTP_422_UNPROCESSABLE_ENTITY, ) -from classes.exceptions import * +from classes.exceptions import ( + AlbumNotFoundError, + AlbumAlreadyExistsError, + AlbumIncorrectError, + PhotoNotFoundError, + PhotoSearchQueryEmptyError, + VideoNotFoundError, + VideoSearchQueryEmptyError, + SearchPageInvalidError, + SearchTokenInvalidError, + AccessTokenInvalidError, + UserEmailCodeInvalid, + UserAlreadyExists, + UserCredentialsInvalid, +) from modules.app import app diff --git a/extensions/photos.py b/extensions/photos.py index 145b241..6855f8c 100644 --- a/extensions/photos.py +++ b/extensions/photos.py @@ -1,4 +1,3 @@ -import pickle import re from datetime import datetime, timedelta, timezone from os import makedirs, path, remove, system @@ -12,30 +11,37 @@ import aiofiles from bson.errors import InvalidId from bson.objectid import ObjectId from fastapi import Security, UploadFile -from fastapi.exceptions import HTTPException from fastapi.responses import Response, UJSONResponse from jose import JWTError, jwt from magic import Magic from plum.exceptions import UnpackError from pydantic import ValidationError from pymongo import DESCENDING -from starlette.status import (HTTP_204_NO_CONTENT, HTTP_401_UNAUTHORIZED, - HTTP_409_CONFLICT) +from starlette.status import HTTP_204_NO_CONTENT, HTTP_409_CONFLICT -from classes.exceptions import (AccessTokenInvalidError, - AlbumNameNotFoundError, PhotoNotFoundError, - PhotoSearchQueryEmptyError, - SearchPageInvalidError, - SearchTokenInvalidError) +from classes.exceptions import ( + AccessTokenInvalidError, + AlbumNameNotFoundError, + PhotoNotFoundError, + PhotoSearchQueryEmptyError, + SearchPageInvalidError, + SearchTokenInvalidError, +) from classes.models import Photo, PhotoPublic, SearchResultsPhoto from modules.app import app from modules.database import col_albums, col_photos, col_tokens from modules.exif_reader import extract_location from modules.hasher import get_duplicates, get_phash from modules.scheduler import scheduler -from modules.security import (ALGORITHM, SECRET_KEY, TokenData, User, - create_access_token, get_current_active_user, - get_user) +from modules.security import ( + ALGORITHM, + SECRET_KEY, + TokenData, + User, + create_access_token, + get_current_active_user, + get_user, +) from modules.utils import configGet, logWrite diff --git a/extensions/videos.py b/extensions/videos.py index 773fa64..bacf746 100644 --- a/extensions/videos.py +++ b/extensions/videos.py @@ -1,4 +1,3 @@ -import pickle import re from datetime import datetime, timezone from os import makedirs, path, remove