chore(deps): update dependency ruff to ^0.12.0 (#5568)

Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
Michael Genson
2025-06-24 02:46:49 -05:00
committed by GitHub
parent c965d12bf1
commit cea3ddc883
13 changed files with 67 additions and 93 deletions

View File

@@ -6,20 +6,18 @@ See their repository for details -> https://github.com/dmontagu/fastapi-utils
import inspect
from collections.abc import Callable
from typing import Any, ClassVar, ForwardRef, TypeVar, cast, get_origin, get_type_hints
from typing import Any, ClassVar, ForwardRef, cast, get_origin, get_type_hints
from fastapi import APIRouter, Depends
from fastapi.routing import APIRoute
from starlette.routing import Route, WebSocketRoute
T = TypeVar("T")
CBV_CLASS_KEY = "__cbv_class__"
INCLUDE_INIT_PARAMS_KEY = "__include_init_params__"
RETURN_TYPES_FUNC_KEY = "__return_types_func__"
def controller(router: APIRouter, *urls: str) -> Callable[[type[T]], type[T]]:
def controller[T](router: APIRouter, *urls: str) -> Callable[[type[T]], type[T]]:
"""
This function returns a decorator that converts the decorated into a class-based view for the provided router.
Any methods of the decorated class that are decorated as endpoints using the router provided to this function
@@ -36,7 +34,7 @@ def controller(router: APIRouter, *urls: str) -> Callable[[type[T]], type[T]]:
return decorator
def _cbv(router: APIRouter, cls: type[T], *urls: str, instance: Any | None = None) -> type[T]:
def _cbv[T](router: APIRouter, cls: type[T], *urls: str, instance: Any | None = None) -> type[T]:
"""
Replaces any methods of the provided class `cls` that are endpoints of routes in `router` with updated
function calls that will properly inject an instance of `cls`.

View File

@@ -1,6 +1,5 @@
from collections.abc import Callable
from logging import Logger
from typing import Generic, TypeVar
import sqlalchemy.exc
from fastapi import HTTPException, status
@@ -9,12 +8,8 @@ from pydantic import UUID4, BaseModel
from mealie.repos.repository_generic import RepositoryGeneric
from mealie.schema.response import ErrorResponse
C = TypeVar("C", bound=BaseModel)
R = TypeVar("R", bound=BaseModel)
U = TypeVar("U", bound=BaseModel)
class HttpRepo(Generic[C, R, U]):
class HttpRepo[C: BaseModel, R: BaseModel, U: BaseModel]:
"""
The HttpRepo[C, R, U] class is a mixin class that provides a common set of methods for CRUD operations.
This class is intended to be used in a composition pattern where a class has a mixin property. For example: