mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-12-08 11:25:17 -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:
@@ -62,7 +62,14 @@ class QueryFilter:
|
||||
self.filter_components = QueryFilter._parse_base_components_into_filter_components(base_components)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f'<<{" ".join([str(component.value if isinstance(component, LogicalOperator) else component) for component in self.filter_components])}>>'
|
||||
joined = " ".join(
|
||||
[
|
||||
str(component.value if isinstance(component, LogicalOperator) else component)
|
||||
for component in self.filter_components
|
||||
],
|
||||
)
|
||||
|
||||
return f"<<{joined}>>"
|
||||
|
||||
def filter_query(self, query: Query, model: type[Model]) -> Query:
|
||||
segments: list[str] = []
|
||||
@@ -76,8 +83,9 @@ class QueryFilter:
|
||||
segments.append(component.value)
|
||||
continue
|
||||
|
||||
# for some reason typing doesn't like the lsep and rsep literals, so we explicitly mark this as a filter component instead
|
||||
# cast doesn't actually do anything at runtime
|
||||
# for some reason typing doesn't like the lsep and rsep literals, so
|
||||
# we explicitly mark this as a filter component instead cast doesn't
|
||||
# actually do anything at runtime
|
||||
component = cast(QueryFilterComponent, component)
|
||||
|
||||
if not hasattr(model, component.attribute_name):
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from mealie.schema._mealie import MealieModel
|
||||
@@ -8,10 +6,10 @@ from mealie.schema._mealie import MealieModel
|
||||
class ErrorResponse(BaseModel):
|
||||
message: str
|
||||
error: bool = True
|
||||
exception: Optional[str] = None
|
||||
exception: str | None = None
|
||||
|
||||
@classmethod
|
||||
def respond(cls, message: str, exception: Optional[str] = None) -> dict:
|
||||
def respond(cls, message: str, exception: str | None = None) -> dict:
|
||||
"""
|
||||
This method is an helper to create an object and convert to a dictionary
|
||||
in the same call, for use while providing details to a HTTPException
|
||||
|
||||
Reference in New Issue
Block a user