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
+45 -16
View File
@@ -5,6 +5,7 @@ non-empty listing so a transient Plex glitch (an empty page) can never wipe a wh
DB lane (`db` fixture) — skipped without Postgres. Drives `_sync_movies` / `_sync_shows` directly
with a stub Plex (the same seam the overlay test uses), so no live server is needed.
"""
from sqlalchemy import select
from app.models import (
@@ -63,10 +64,12 @@ def _seed_movies(db):
db.add(user)
db.flush()
# A watch-state on EACH movie: the kept one's must survive, the pruned one's must cascade away.
db.add_all([
PlexState(user_id=user.id, item_id=m1.id, status="watched"),
PlexState(user_id=user.id, item_id=m2.id, status="watched"),
])
db.add_all(
[
PlexState(user_id=user.id, item_id=m1.id, status="watched"),
PlexState(user_id=user.id, item_id=m2.id, status="watched"),
]
)
db.commit()
return lib, m1.id, m2.id, user.id
@@ -132,22 +135,48 @@ def test_show_prune_removes_stale_show_season_and_episode(db):
se2 = PlexSeason(rating_key="se2", show_id=s2.id, season_number=1)
db.add_all([se1, se2])
db.flush()
e1 = PlexItem(rating_key="e1", library_id=lib.id, kind="episode", title="Kept Ep",
show_id=s1.id, season_id=se1.id, season_number=1, episode_number=1)
e2 = PlexItem(rating_key="e2", library_id=lib.id, kind="episode", title="Gone Ep",
show_id=s2.id, season_id=se2.id, season_number=1, episode_number=1)
e1 = PlexItem(
rating_key="e1",
library_id=lib.id,
kind="episode",
title="Kept Ep",
show_id=s1.id,
season_id=se1.id,
season_number=1,
episode_number=1,
)
e2 = PlexItem(
rating_key="e2",
library_id=lib.id,
kind="episode",
title="Gone Ep",
show_id=s2.id,
season_id=se2.id,
season_number=1,
episode_number=1,
)
db.add_all([e1, e2])
db.commit()
# Plex now lists only s1's subtree.
stub = _StubPlex({
_TYPE_SHOW: [{"ratingKey": "s1", "title": "Kept Show"}],
_TYPE_SEASON: [{"ratingKey": "se1", "parentRatingKey": "s1", "index": 1, "title": "Season 1"}],
_TYPE_EPISODE: [{
"ratingKey": "e1", "grandparentRatingKey": "s1", "parentRatingKey": "se1",
"parentIndex": 1, "index": 1, "title": "Kept Ep",
}],
})
stub = _StubPlex(
{
_TYPE_SHOW: [{"ratingKey": "s1", "title": "Kept Show"}],
_TYPE_SEASON: [
{"ratingKey": "se1", "parentRatingKey": "s1", "index": 1, "title": "Season 1"}
],
_TYPE_EPISODE: [
{
"ratingKey": "e1",
"grandparentRatingKey": "s1",
"parentRatingKey": "se1",
"parentIndex": 1,
"index": 1,
"title": "Kept Ep",
}
],
}
)
stats = {"shows": 0, "seasons": 0, "episodes": 0, "pruned": 0}
_sync_shows(db, stub, lib, stats)