style: apply ruff format across backend + scripts (line-length 100)

Mechanical, whole-tree `ruff format` pass — no behaviour change. Recorded in
.git-blame-ignore-revs (next commit) so git blame skips it.
This commit is contained in:
2026-08-23 07:43:06 +02:00
parent 434a98d6ed
commit b1832afd18
217 changed files with 3149 additions and 1744 deletions
+30 -7
View File
@@ -5,6 +5,7 @@ browse scope. Also covers the canonical-guid parse and that the generated search
Uses the DB lane (`db` fixture) — skipped when no Postgres is reachable. Runs against the real schema
(migrations 0063/0064) so the JSONB + STORED generated columns are exercised.
"""
from sqlalchemy import func, select
import app.plex.sync as syncmod
@@ -25,7 +26,12 @@ class _StubPlex:
def _hu_movie(rk: str, title: str, summary: str, genres: list[str], guid: str | None) -> dict:
meta = {"ratingKey": rk, "title": title, "summary": summary, "Genre": [{"tag": g} for g in genres]}
meta = {
"ratingKey": rk,
"title": title,
"summary": summary,
"Genre": [{"tag": g} for g in genres],
}
if guid:
meta["Guid"] = [{"id": guid}]
return meta
@@ -68,7 +74,9 @@ def test_sync_overlay_writes_hu_onto_matched_en_rows(db):
assert matched.title_hu == "Öldöklés"
assert matched.summary_hu == "Egy rablás terve."
assert matched.genres_hu == ["Akció", "Krimi"]
assert matched.search_vector_hu is not None # the STORED generated column populated from title_hu
assert (
matched.search_vector_hu is not None
) # the STORED generated column populated from title_hu
# The unmatched EN row keeps NULL HU fields (serving falls back to EN).
assert unmatched.title_hu is None
assert stats["overlaid"] == 1
@@ -110,8 +118,11 @@ class _StubClient:
elif key == "9":
items = [
{
"ratingKey": "hu1", "title": "Öldöklés", "summary": "Rablás.",
"Genre": [{"tag": "Akció"}], "Guid": [{"id": "tmdb://1"}],
"ratingKey": "hu1",
"title": "Öldöklés",
"summary": "Rablás.",
"Genre": [{"tag": "Akció"}],
"Guid": [{"id": "tmdb://1"}],
}
]
else:
@@ -158,8 +169,14 @@ def test_overlay_reconcile_clears_stale_hu_when_twin_vanishes(db):
db.flush()
hu_lib.overlay_of = en_lib.id
row = PlexItem(
rating_key="m1", library_id=en_lib.id, kind="movie", title="Heat",
guid="tmdb:1", title_hu="Öldöklés", summary_hu="régi", genres_hu=["Akció"],
rating_key="m1",
library_id=en_lib.id,
kind="movie",
title="Heat",
guid="tmdb:1",
title_hu="Öldöklés",
summary_hu="régi",
genres_hu=["Akció"],
)
db.add(row)
db.commit()
@@ -185,7 +202,13 @@ def test_overlay_applies_to_all_editions_sharing_a_guid(db):
db.flush()
hu_lib.overlay_of = en_lib.id
ed1 = PlexItem(rating_key="a", library_id=en_lib.id, kind="movie", title="Heat", guid="tmdb:1")
ed2 = PlexItem(rating_key="b", library_id=en_lib.id, kind="movie", title="Heat (Director's Cut)", guid="tmdb:1")
ed2 = PlexItem(
rating_key="b",
library_id=en_lib.id,
kind="movie",
title="Heat (Director's Cut)",
guid="tmdb:1",
)
db.add_all([ed1, ed2])
db.commit()