Sorted imports with isort

This commit is contained in:
Profitroll 2023-06-22 13:17:53 +02:00
parent 47435c6128
commit 83dd4b6746
Signed by: profitroll
GPG Key ID: FA35CAB49DACD3B2
14 changed files with 82 additions and 97 deletions

View File

@ -1,4 +1,5 @@
from typing import List, Union
from pydantic import BaseModel

View File

@ -1,7 +1,5 @@
from fastapi import Request
from fastapi.responses import UJSONResponse
from modules.app import app
from classes.exceptions import *
from starlette.status import (
HTTP_400_BAD_REQUEST,
HTTP_401_UNAUTHORIZED,
@ -11,6 +9,9 @@ from starlette.status import (
HTTP_422_UNPROCESSABLE_ENTITY,
)
from classes.exceptions import *
from modules.app import app
@app.exception_handler(AlbumNotFoundError)
async def album_not_found_exception_handler(request: Request, exc: AlbumNotFoundError):

View File

@ -1,8 +1,10 @@
import aiofiles
from os import path
from modules.app import app
import aiofiles
from fastapi.responses import HTMLResponse, Response
from modules.app import app
@app.get("/pages/matter.css", include_in_schema=False)
async def page_matter():

View File

@ -1,54 +1,41 @@
import aiofiles
import re
import pickle
import re
from datetime import datetime, timedelta, timezone
from os import makedirs, path, remove, system
from secrets import token_urlsafe
from shutil import move
from threading import Thread
from typing import Union
from uuid import uuid4
from magic import Magic
from datetime import datetime, timedelta, timezone
from os import makedirs, path, remove, system
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 classes.exceptions import (
AccessTokenInvalidError,
AlbumNameNotFoundError,
PhotoNotFoundError,
from pymongo import DESCENDING
from starlette.status import (HTTP_204_NO_CONTENT, HTTP_401_UNAUTHORIZED,
HTTP_409_CONFLICT)
from classes.exceptions import (AccessTokenInvalidError,
AlbumNameNotFoundError, PhotoNotFoundError,
PhotoSearchQueryEmptyError,
SearchPageInvalidError,
SearchTokenInvalidError,
)
SearchTokenInvalidError)
from classes.models import Photo, PhotoPublic, SearchResultsPhoto
from modules.exif_reader import extract_location
from modules.hasher import get_phash, get_duplicates
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.app import app
from modules.database import col_photos, col_albums, col_tokens
from pymongo import DESCENDING
from bson.objectid import ObjectId
from bson.errors import InvalidId
from plum.exceptions import UnpackError
from jose import JWTError, jwt
from fastapi import UploadFile, Security
from fastapi.responses import UJSONResponse, Response
from fastapi.exceptions import HTTPException
from starlette.status import (
HTTP_204_NO_CONTENT,
HTTP_401_UNAUTHORIZED,
HTTP_409_CONFLICT,
)
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.utils import configGet, logWrite

View File

@ -1,12 +1,10 @@
from datetime import timedelta
from classes.exceptions import UserCredentialsInvalid
from modules.app import app
from fastapi import Depends
from fastapi.security import (
OAuth2PasswordRequestForm,
)
from fastapi.security import OAuth2PasswordRequestForm
from classes.exceptions import UserCredentialsInvalid
from modules.app import app
from modules.security import (
ACCESS_TOKEN_EXPIRE_DAYS,
Token,

View File

@ -1,27 +1,19 @@
from datetime import datetime, timedelta
from uuid import uuid1
from fastapi import Depends, Form
from fastapi.responses import Response, UJSONResponse
from starlette.status import HTTP_204_NO_CONTENT
from classes.exceptions import (
UserAlreadyExists,
UserCredentialsInvalid,
UserEmailCodeInvalid,
)
from modules.database import (
col_users,
col_albums,
col_photos,
col_emails,
col_videos,
col_emails,
)
from modules.app import app
from modules.utils import configGet, logWrite
from modules.scheduler import scheduler
from modules.database import col_albums, col_emails, col_photos, col_users, col_videos
from modules.mailer import mail_sender
from uuid import uuid1
from fastapi import Depends, Form
from fastapi.responses import Response, UJSONResponse
from starlette.status import HTTP_204_NO_CONTENT
from modules.scheduler import scheduler
from modules.security import (
User,
get_current_active_user,
@ -29,6 +21,7 @@ from modules.security import (
get_user,
verify_password,
)
from modules.utils import configGet, logWrite
async def send_confirmation(user: str, email: str):

View File

@ -1,12 +1,20 @@
import aiofiles
import re
import pickle
import re
from datetime import datetime, timezone
from os import makedirs, path, remove
from secrets import token_urlsafe
from shutil import move
from typing import Union
import aiofiles
from bson.errors import InvalidId
from bson.objectid import ObjectId
from fastapi import Security, UploadFile
from fastapi.responses import Response, UJSONResponse
from magic import Magic
from datetime import datetime, timezone
from os import makedirs, path, remove
from pymongo import DESCENDING
from starlette.status import HTTP_204_NO_CONTENT
from classes.exceptions import (
AlbumNameNotFoundError,
SearchPageInvalidError,
@ -14,17 +22,10 @@ from classes.exceptions import (
VideoNotFoundError,
VideoSearchQueryEmptyError,
)
from classes.models import Video, SearchResultsVideo, VideoPublic
from modules.security import User, get_current_active_user
from classes.models import SearchResultsVideo, Video, VideoPublic
from modules.app import app
from modules.database import col_videos, col_albums, col_tokens
from bson.objectid import ObjectId
from bson.errors import InvalidId
from pymongo import DESCENDING
from fastapi import UploadFile, Security
from fastapi.responses import UJSONResponse, Response
from starlette.status import HTTP_204_NO_CONTENT
from modules.database import col_albums, col_tokens, col_videos
from modules.security import User, get_current_active_user
video_post_responses = {404: AlbumNameNotFoundError("name").openapi}

View File

@ -1,6 +1,5 @@
from fastapi import FastAPI
from fastapi.openapi.docs import get_swagger_ui_html, get_redoc_html
from fastapi.openapi.docs import get_redoc_html, get_swagger_ui_html
app = FastAPI(title="END PLAY Photos", docs_url=None, redoc_url=None, version="0.2")

View File

@ -1,5 +1,6 @@
from pymongo import GEOSPHERE, MongoClient
from modules.utils import configGet
from pymongo import MongoClient, GEOSPHERE
db_config = configGet("database")

View File

@ -1,8 +1,9 @@
from modules.database import col_photos
import cv2
import numpy as np
from numpy.typing import NDArray
from scipy import spatial
import cv2
from modules.database import col_photos
def hash_array_to_hash_hex(hash_array):

View File

@ -1,6 +1,7 @@
from smtplib import SMTP, SMTP_SSL
from traceback import print_exc
from ssl import create_default_context
from traceback import print_exc
from modules.utils import configGet, logWrite
try:

View File

@ -1,16 +1,13 @@
from datetime import datetime, timedelta, timezone
from typing import List, Union
from modules.database import col_users
from fastapi import Depends, HTTPException, Security, status
from fastapi.security import (
OAuth2PasswordBearer,
SecurityScopes,
)
from fastapi.security import OAuth2PasswordBearer, SecurityScopes
from jose import JWTError, jwt
from passlib.context import CryptContext
from pydantic import BaseModel, ValidationError
from modules.database import col_users
with open("secret_key", "r", encoding="utf-8") as f:
SECRET_KEY = f.read()

View File

@ -1,6 +1,7 @@
from typing import Any, Union
from ujson import loads, dumps, JSONDecodeError
from traceback import print_exc
from typing import Any, Union
from ujson import JSONDecodeError, dumps, loads
# Print to stdout and then to log

View File

@ -1,10 +1,12 @@
from os import makedirs, path
from modules.app import app
from modules.utils import *
from modules.scheduler import scheduler
from modules.extensions_loader import dynamic_import_from_src
from fastapi.responses import FileResponse
from modules.app import app
from modules.extensions_loader import dynamic_import_from_src
from modules.scheduler import scheduler
from modules.utils import *
makedirs(path.join("data", "users"), exist_ok=True)