mirror of
https://github.com/flibusta-apps/book_library_server.git
synced 2025-12-06 15:15:36 +01:00
Migrate to ruff
This commit is contained in:
@@ -8,7 +8,6 @@ from app.views.sequence import sequence_router
|
||||
from app.views.source import source_router
|
||||
from app.views.translation import translation_router
|
||||
|
||||
|
||||
routers = [
|
||||
source_router,
|
||||
author_router,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from fastapi import APIRouter, Depends, Request, HTTPException, status
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Request, status
|
||||
from fastapi_pagination import Params
|
||||
from fastapi_pagination.ext.ormar import paginate
|
||||
|
||||
@@ -13,7 +12,6 @@ from app.services.author import AuthorMeiliSearchService, GetRandomAuthorService
|
||||
from app.services.translator import TranslatorMeiliSearchService
|
||||
from app.utils.pagination import CustomPage
|
||||
|
||||
|
||||
author_router = APIRouter(
|
||||
prefix="/api/v1/authors",
|
||||
tags=["author"],
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
|
||||
from fastapi_pagination import Params, Page
|
||||
from fastapi_pagination import Page, Params
|
||||
from fastapi_pagination.ext.ormar import paginate
|
||||
|
||||
from app.depends import check_token
|
||||
from app.models import AuthorAnnotation as AuthorAnnotationDB
|
||||
from app.serializers.author_annotation import AuthorAnnotation
|
||||
|
||||
|
||||
author_annotation_router = APIRouter(
|
||||
prefix="/api/v1/author_annotations",
|
||||
tags=["author_annotation"],
|
||||
|
||||
@@ -1,23 +1,21 @@
|
||||
from typing import Optional
|
||||
|
||||
from fastapi import APIRouter, Depends, Request, HTTPException, status
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Request, status
|
||||
from fastapi_pagination import Params
|
||||
|
||||
from app.depends import check_token, get_allowed_langs
|
||||
from app.filters.book import get_book_filter
|
||||
from app.models import Book as BookDB
|
||||
from app.models import BookAnnotation as BookAnnotationDB
|
||||
from app.serializers.book import Book, RemoteBook, BookDetail
|
||||
from app.serializers.book import Book, BookDetail, RemoteBook
|
||||
from app.serializers.book_annotation import BookAnnotation
|
||||
from app.services.book import (
|
||||
BookMeiliSearchService,
|
||||
BookFilterService,
|
||||
BookMeiliSearchService,
|
||||
GetRandomBookService,
|
||||
)
|
||||
from app.utils.pagination import CustomPage
|
||||
|
||||
|
||||
book_router = APIRouter(
|
||||
prefix="/api/v1/books",
|
||||
tags=["book"],
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
|
||||
from fastapi_pagination import Params, Page
|
||||
from fastapi_pagination import Page, Params
|
||||
from fastapi_pagination.ext.ormar import paginate
|
||||
|
||||
from app.depends import check_token
|
||||
from app.models import BookAnnotation as BookAnnotationDB
|
||||
from app.serializers.book_annotation import BookAnnotation
|
||||
|
||||
|
||||
book_annotation_router = APIRouter(
|
||||
prefix="/api/v1/book_annotations",
|
||||
tags=["book_annotation"],
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from fastapi import APIRouter, Depends, HTTPException, status, Request
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Request, status
|
||||
from fastapi_pagination import Params
|
||||
from fastapi_pagination.ext.ormar import paginate
|
||||
|
||||
@@ -10,7 +9,6 @@ from app.serializers.genre import Genre
|
||||
from app.services.genre import GenreMeiliSearchService
|
||||
from app.utils.pagination import CustomPage
|
||||
|
||||
|
||||
genre_router = APIRouter(
|
||||
prefix="/api/v1/genres", tags=["genres"], dependencies=[Depends(check_token)]
|
||||
)
|
||||
@@ -31,7 +29,8 @@ async def get_genres(genre_filter: dict = Depends(get_genre_filter)):
|
||||
@genre_router.get("/metas", response_model=list[str])
|
||||
async def get_genre_metas():
|
||||
genres = await GenreDB.objects.fields("meta").values_list(flatten=True)
|
||||
return sorted(list(set(genres)))
|
||||
genres.sort()
|
||||
return list(set(genres))
|
||||
|
||||
|
||||
@genre_router.get("/{id}", response_model=Genre)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from fastapi import APIRouter
|
||||
|
||||
|
||||
healtcheck_router = APIRouter(tags=["healthcheck"])
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from fastapi import APIRouter, Depends, Request
|
||||
|
||||
from fastapi_pagination import Params
|
||||
from fastapi_pagination.ext.ormar import paginate
|
||||
|
||||
@@ -8,10 +7,9 @@ from app.models import Book as BookDB
|
||||
from app.models import Sequence as SequenceDB
|
||||
from app.serializers.sequence import Book as SequenceBook
|
||||
from app.serializers.sequence import Sequence
|
||||
from app.services.sequence import SequenceMeiliSearchService, GetRandomSequenceService
|
||||
from app.services.sequence import GetRandomSequenceService, SequenceMeiliSearchService
|
||||
from app.utils.pagination import CustomPage
|
||||
|
||||
|
||||
sequence_router = APIRouter(
|
||||
prefix="/api/v1/sequences",
|
||||
tags=["sequence"],
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
from fastapi import APIRouter, Depends
|
||||
|
||||
from fastapi_pagination import Params, Page
|
||||
from fastapi_pagination import Page, Params
|
||||
from fastapi_pagination.ext.ormar import paginate
|
||||
|
||||
from app.depends import check_token
|
||||
from app.models import Source as SourceDB
|
||||
from app.serializers.source import Source
|
||||
|
||||
|
||||
source_router = APIRouter(
|
||||
prefix="/api/v1/sources",
|
||||
tags=["source"],
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from fastapi import APIRouter, Depends
|
||||
|
||||
from fastapi_pagination import Params
|
||||
from fastapi_pagination.ext.ormar import paginate
|
||||
|
||||
@@ -8,7 +7,6 @@ from app.models import Translation as TranslationDB
|
||||
from app.serializers.translation import Translation
|
||||
from app.utils.pagination import CustomPage
|
||||
|
||||
|
||||
translation_router = APIRouter(
|
||||
prefix="/api/v1/translation",
|
||||
tags=["translation"],
|
||||
|
||||
Reference in New Issue
Block a user