chore(deps): update dependency ruff to ^0.9.0 (#4871)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com>
Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
renovate[bot]
2025-01-13 15:43:55 +00:00
committed by GitHub
parent ea0bec2336
commit 2c2de1e95b
22 changed files with 124 additions and 138 deletions

View File

@@ -112,7 +112,7 @@ class TandoorMigrator(BaseMigrator):
recipes_as_dicts: list[dict] = []
for i, recipe_zip_file in enumerate(source_dir.glob("*.zip")):
try:
recipe_dir = str(source_dir.joinpath(f"recipe_{i+1}"))
recipe_dir = str(source_dir.joinpath(f"recipe_{i + 1}"))
os.makedirs(recipe_dir)
with zipfile.ZipFile(recipe_zip_file) as recipe_zip:

View File

@@ -129,10 +129,7 @@ def clean_image(image: str | list | dict | None = None, default: str = "no image
case [{"@id": str(_)}, *_]:
return [x["@id"] for x in image if "@id" in x]
case _:
logger.exception(
f"Unexpected type for image: {
type(image)}, {image}"
)
logger.exception(f"Unexpected type for image: {type(image)}, {image}")
return [default]
@@ -227,10 +224,7 @@ def clean_instructions(steps_object: list | dict | str, default: list | None = N
)
)
case _:
raise TypeError(
f"Unexpected type for instructions: {
type(steps_object)}, {steps_object}"
)
raise TypeError(f"Unexpected type for instructions: {type(steps_object)}, {steps_object}")
def _sanitize_instruction_text(line: str | dict) -> str:
@@ -290,10 +284,7 @@ def clean_ingredients(ingredients: list | str | None, default: list | None = Non
case str(ingredients):
return [clean_string(ingredient) for ingredient in ingredients.splitlines() if ingredient.strip()]
case _:
raise TypeError(
f"Unexpected type for ingredients: {
type(ingredients)}, {ingredients}"
)
raise TypeError(f"Unexpected type for ingredients: {type(ingredients)}, {ingredients}")
def clean_int(val: str | int | None, min: int | None = None, max: int | None = None):
@@ -531,10 +522,7 @@ def clean_categories(category: str | list) -> list[str]:
#
return [cat["name"] for cat in category if "name" in cat]
case _:
raise TypeError(
f"Unexpected type for category: {
type(category)}, {category}"
)
raise TypeError(f"Unexpected type for category: {type(category)}, {category}")
def clean_tags(data: str | list[str]) -> list[str]: