mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-02-07 08:23:12 -05:00
chores: updates-and-linters (#1868)
* switch to ruff * add ruff * run ruff --fix * update ruff * resolve ruff errors * drop isort from CI * fix decorator order
This commit is contained in:
@@ -283,7 +283,7 @@ class RepositoryGeneric(Generic[Schema, Model]):
|
||||
|
||||
except ValueError as e:
|
||||
self.logger.error(e)
|
||||
raise HTTPException(status_code=400, detail=str(e))
|
||||
raise HTTPException(status_code=400, detail=str(e)) from e
|
||||
|
||||
count = query.count()
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from typing import Union
|
||||
|
||||
from pydantic import UUID4
|
||||
|
||||
from mealie.db.models.group import Group
|
||||
@@ -15,7 +13,7 @@ from .repository_generic import RepositoryGeneric
|
||||
|
||||
|
||||
class RepositoryGroup(RepositoryGeneric[GroupInDB, Group]):
|
||||
def get_by_name(self, name: str, limit=1) -> Union[GroupInDB, Group, None]:
|
||||
def get_by_name(self, name: str, limit=1) -> GroupInDB | Group | None:
|
||||
dbgroup = self.session.query(self.model).filter_by(**{"name": name}).one_or_none()
|
||||
if dbgroup is None:
|
||||
return None
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from random import randint
|
||||
from typing import Any, Optional
|
||||
from typing import Any
|
||||
from uuid import UUID
|
||||
|
||||
from pydantic import UUID4
|
||||
@@ -135,10 +135,10 @@ class RepositoryRecipes(RepositoryGeneric[Recipe, RecipeModel]):
|
||||
pagination: PaginationQuery,
|
||||
override=None,
|
||||
load_food=False,
|
||||
cookbook: Optional[ReadCookBook] = None,
|
||||
categories: Optional[list[UUID4 | str]] = None,
|
||||
tags: Optional[list[UUID4 | str]] = None,
|
||||
tools: Optional[list[UUID4 | str]] = None,
|
||||
cookbook: ReadCookBook | None = None,
|
||||
categories: list[UUID4 | str] | None = None,
|
||||
tags: list[UUID4 | str] | None = None,
|
||||
tools: list[UUID4 | str] | None = None,
|
||||
) -> RecipePagination:
|
||||
q = self.session.query(self.model)
|
||||
|
||||
@@ -307,7 +307,7 @@ class RepositoryRecipes(RepositoryGeneric[Recipe, RecipeModel]):
|
||||
.limit(limit)
|
||||
]
|
||||
|
||||
def get_by_slug(self, group_id: UUID4, slug: str, limit=1) -> Optional[Recipe]:
|
||||
def get_by_slug(self, group_id: UUID4, slug: str, limit=1) -> Recipe | None:
|
||||
dbrecipe = (
|
||||
self.session.query(RecipeModel)
|
||||
.filter(RecipeModel.group_id == group_id, RecipeModel.slug == slug)
|
||||
|
||||
Reference in New Issue
Block a user