mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-02-04 15:03:10 -05:00
chore: update linters (#2095)
* update deps * ruff auto-fixes * refactor match statements where possible
This commit is contained in:
@@ -43,18 +43,18 @@ class GroupMigrationController(BaseUserController):
|
||||
"add_migration_tag": add_migration_tag,
|
||||
}
|
||||
|
||||
migrator: BaseMigrator
|
||||
table: dict[SupportedMigrations, type[BaseMigrator]] = {
|
||||
SupportedMigrations.chowdown: ChowdownMigrator,
|
||||
SupportedMigrations.mealie_alpha: MealieAlphaMigrator,
|
||||
SupportedMigrations.nextcloud: NextcloudMigrator,
|
||||
SupportedMigrations.paprika: PaprikaMigrator,
|
||||
}
|
||||
|
||||
match migration_type: # noqa match not supported by ruff
|
||||
case SupportedMigrations.chowdown:
|
||||
migrator = ChowdownMigrator(**args)
|
||||
case SupportedMigrations.mealie_alpha:
|
||||
migrator = MealieAlphaMigrator(**args)
|
||||
case SupportedMigrations.nextcloud:
|
||||
migrator = NextcloudMigrator(**args)
|
||||
case SupportedMigrations.paprika:
|
||||
migrator = PaprikaMigrator(**args)
|
||||
case _:
|
||||
raise ValueError(f"Unsupported migration type: {migration_type}")
|
||||
constructor = table.get(migration_type, None)
|
||||
|
||||
if constructor is None:
|
||||
raise ValueError(f"Unsupported migration type: {migration_type}")
|
||||
|
||||
migrator = constructor(**args)
|
||||
|
||||
return migrator.migrate(f"{migration_type.value.title()} Migration")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from collections.abc import Callable
|
||||
from functools import cached_property
|
||||
from typing import Callable
|
||||
|
||||
from fastapi import APIRouter, Depends, Query
|
||||
from pydantic import UUID4
|
||||
|
||||
Reference in New Issue
Block a user