diff --git a/alembic/env.py b/alembic/env.py index 4fb3708..33e5648 100644 --- a/alembic/env.py +++ b/alembic/env.py @@ -1,12 +1,11 @@ +import os from logging.config import fileConfig -from sqlalchemy import engine_from_config -from sqlalchemy import pool +from dotenv import load_dotenv +from sqlalchemy import engine_from_config, pool from alembic import context from src.models import * # noqa -from dotenv import load_dotenv -import os load_dotenv() diff --git a/alembic/versions/cbf112934370_added_s3_table.py b/alembic/versions/cbf112934370_added_s3_table.py index 6d7b4be..e5d8e6b 100644 --- a/alembic/versions/cbf112934370_added_s3_table.py +++ b/alembic/versions/cbf112934370_added_s3_table.py @@ -7,9 +7,9 @@ """ from typing import Sequence, Union -from alembic import op import sqlalchemy as sa +from alembic import op # revision identifiers, used by Alembic. revision: str = "cbf112934370" diff --git a/src/celery.py b/src/celery.py index fdb0308..7a44f65 100644 --- a/src/celery.py +++ b/src/celery.py @@ -1,5 +1,5 @@ from celery import Celery -from src.config import Settings +from src.config import Settings default = Celery("default", broker=Settings.REDIS_URL, backend=Settings.REDIS_URL) diff --git a/src/logger.py b/src/logger.py index 69aae46..ad9fa77 100644 --- a/src/logger.py +++ b/src/logger.py @@ -1,6 +1,7 @@ import logging import logging.handlers import os + from src.config import Settings diff --git a/src/main.py b/src/main.py index 3eda746..8fbdb3a 100644 --- a/src/main.py +++ b/src/main.py @@ -1,8 +1,10 @@ from typing import Dict + from fastapi import FastAPI from fastapi.staticfiles import StaticFiles -from src.routes import index, s3 + from src.logger import logger +from src.routes import index, s3 from src.utils import get_current_date_time app = FastAPI() diff --git a/src/models/database.py b/src/models/database.py index 942b46d..916bd6b 100644 --- a/src/models/database.py +++ b/src/models/database.py @@ -1,8 +1,10 @@ +from datetime import datetime from typing import Any, Generator -from sqlalchemy import Column, Integer, create_engine, DateTime + +from sqlalchemy import Column, DateTime, Integer, create_engine from sqlalchemy.ext.declarative import declarative_base -from sqlalchemy.orm import sessionmaker, Session -from datetime import datetime +from sqlalchemy.orm import Session, sessionmaker + from src.config import Settings engine = create_engine(Settings.DATABASE_URL) diff --git a/src/models/s3.py b/src/models/s3.py index b4bc583..e2c91f8 100644 --- a/src/models/s3.py +++ b/src/models/s3.py @@ -1,4 +1,5 @@ from sqlalchemy import Column, String + from src.models.database import BaseModel from src.s3 import get_object_url diff --git a/src/redis.py b/src/redis.py index c0fb4ca..db706ad 100644 --- a/src/redis.py +++ b/src/redis.py @@ -1,4 +1,5 @@ from redis import Redis + from src.config import Settings redis_conn = Redis(host=Settings.REDIS_HOST, port=Settings.REDIS_PORT, db=Settings.REDIS_DB) diff --git a/src/routes/index.py b/src/routes/index.py index 7b218dd..db8f32c 100644 --- a/src/routes/index.py +++ b/src/routes/index.py @@ -1,6 +1,7 @@ from fastapi import APIRouter, Request from fastapi.responses import HTMLResponse from starlette.templating import _TemplateResponse + from src.templates import templates router = APIRouter() diff --git a/src/routes/s3.py b/src/routes/s3.py index e45220f..3fd5ba0 100644 --- a/src/routes/s3.py +++ b/src/routes/s3.py @@ -1,9 +1,9 @@ -from fastapi import APIRouter, Depends, Request, UploadFile, File -from src.logger import logger +from fastapi import APIRouter, Depends, File, Request, UploadFile +from src.config import Settings +from src.logger import logger from src.models.database import get_db from src.models.s3 import S3Object -from src.config import Settings from src.s3 import upload_object_to_s3 router = APIRouter() diff --git a/src/s3.py b/src/s3.py index adf17e7..e864d58 100644 --- a/src/s3.py +++ b/src/s3.py @@ -1,7 +1,9 @@ +import uuid + import boto3 + from src.config import Settings from src.logger import logger -import uuid def get_s3_client():