lint code

This commit is contained in:
grillazz 2025-03-08 17:26:09 +01:00
parent 21de7e2dfc
commit 8f96c8a472
14 changed files with 28 additions and 30 deletions

View File

@ -39,7 +39,7 @@ safety: ## Check project and dependencies with safety https://github.com/pyupio/
.PHONY: py-upgrade
py-upgrade: ## Upgrade project py files with pyupgrade library for python version 3.10
pyupgrade --py312-plus `find app -name "*.py"`
pyupgrade --py313-plus `find app -name "*.py"`
.PHONY: lint
lint: ## Lint project code.

View File

@ -1,12 +1,11 @@
import logging
from typing import Annotated
from fastapi import APIRouter, status, Request, Depends, Query
from fastapi import APIRouter, Depends, Query, Request, status
from pydantic import EmailStr
from starlette.concurrency import run_in_threadpool
from app.services.smtp import SMTPEmailService
from app.utils.logging import AppLogger
logger = AppLogger().get_logger()

View File

@ -1,7 +1,8 @@
import io
from fastapi import APIRouter, Depends, status, UploadFile, HTTPException
from sqlalchemy.exc import SQLAlchemyError
import polars as pl
from fastapi import APIRouter, Depends, HTTPException, UploadFile, status
from sqlalchemy.exc import SQLAlchemyError
from sqlalchemy.ext.asyncio import AsyncSession
from app.database import get_db

View File

@ -1,6 +1,6 @@
import os
from pydantic import PostgresDsn, RedisDsn, computed_field, BaseModel
from pydantic import BaseModel, PostgresDsn, RedisDsn, computed_field
from pydantic_core import MultiHostUrl
from pydantic_settings import BaseSettings, SettingsConfigDict

View File

@ -1,7 +1,6 @@
from collections.abc import AsyncGenerator
from sqlalchemy.ext.asyncio import create_async_engine
from sqlalchemy.ext.asyncio import async_sessionmaker
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
from app.config import settings as global_settings
from app.utils.logging import AppLogger

View File

@ -1,25 +1,24 @@
from contextlib import asynccontextmanager
import asyncpg
from apscheduler.eventbrokers.redis import RedisEventBroker
from apscheduler import AsyncScheduler
from apscheduler.datastores.sqlalchemy import SQLAlchemyDataStore
from fastapi import FastAPI, Depends
from apscheduler.eventbrokers.redis import RedisEventBroker
from fastapi import Depends, FastAPI
from fastapi_cache import FastAPICache
from fastapi_cache.backends.redis import RedisBackend
from app.api.health import router as health_router
from app.api.nonsense import router as nonsense_router
from app.api.shakespeare import router as shakespeare_router
from app.api.stuff import router as stuff_router
from app.api.user import router as user_router
from app.config import settings as global_settings
from app.database import engine
from app.utils.logging import AppLogger
from app.api.user import router as user_router
from app.api.health import router as health_router
from app.redis import get_redis, get_cache
from app.redis import get_cache, get_redis
from app.services.auth import AuthBearer
from app.services.scheduler import SchedulerMiddleware
from contextlib import asynccontextmanager
from apscheduler import AsyncScheduler
from app.utils.logging import AppLogger
logger = AppLogger().get_logger()

View File

@ -2,9 +2,10 @@ from typing import Any
from asyncpg import UniqueViolationError
from fastapi import HTTPException, status
from sqlalchemy.exc import SQLAlchemyError, IntegrityError
from sqlalchemy.exc import IntegrityError, SQLAlchemyError
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import declared_attr, DeclarativeBase
from sqlalchemy.orm import DeclarativeBase, declared_attr
from app.utils.logging import AppLogger
logger = AppLogger().get_logger()

View File

@ -4,7 +4,7 @@ from fastapi import HTTPException, status
from sqlalchemy import String, select
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import mapped_column, Mapped
from sqlalchemy.orm import Mapped, mapped_column
from app.models.base import Base

View File

@ -1,6 +1,6 @@
from uuid import UUID
from pydantic import BaseModel, Field, ConfigDict
from pydantic import BaseModel, ConfigDict, Field
config = ConfigDict(from_attributes=True)

View File

@ -1,11 +1,11 @@
import time
import jwt
from fastapi import HTTPException, Request
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
from app.config import settings as global_settings
from app.models.user import User
from fastapi import Request, HTTPException
from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
from app.utils.logging import AppLogger
logger = AppLogger().get_logger()

View File

@ -1,7 +1,7 @@
from sqlalchemy.dialects import postgresql
from functools import wraps
from sqlalchemy.dialects import postgresql
def compile_sql_or_scalar(func):
"""

View File

@ -3,7 +3,6 @@ import logging
from rich.console import Console
from rich.logging import RichHandler
from app.utils.singleton import SingletonMeta

View File

@ -1,4 +1,4 @@
from locust import HttpUser, task, between
from locust import HttpUser, between, task
class Stuff(HttpUser):

View File

@ -1,5 +1,5 @@
import pytest
from httpx import AsyncClient, ASGITransport
from httpx import ASGITransport, AsyncClient
from app.database import engine
from app.main import app