fix: Lint Python code with ruff (#3799)

This commit is contained in:
Christian Clauss
2024-08-12 17:09:30 +02:00
committed by GitHub
parent 65ece35966
commit 432914e310
41 changed files with 112 additions and 120 deletions

View File

@@ -25,7 +25,7 @@ from mealie.services.backups_v2.backup_v2 import BackupV2
def dict_sorter(d: dict) -> Any:
possible_keys = {"created_at", "id"}
return next((d[key] for key in possible_keys if key in d and d[key]), 1)
return next((d[key] for key in possible_keys if d.get(key)), 1)
# For Future Use
@@ -68,7 +68,7 @@ def test_database_restore():
new_exporter = AlchemyExporter(settings.DB_URL)
snapshop_2 = new_exporter.dump()
for s1, s2 in zip(snapshop_1, snapshop_2):
for s1, s2 in zip(snapshop_1, snapshop_2, strict=False):
assert snapshop_1[s1].sort(key=dict_sorter) == snapshop_2[s2].sort(key=dict_sorter)