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
+91 -23
View File
@@ -11,6 +11,7 @@ That locks the two duplicated branch-sets together BEFORE they are merged into o
the merge is provably behaviour-equivalent (and a drift between grid and facets fails here). DB lane
(`db` fixture) — skipped without Postgres.
"""
from collections import Counter
from datetime import datetime, timezone
@@ -41,22 +42,78 @@ def _seed(db):
db.flush()
# Movies — new / in-progress / watched / hidden, with overlapping genres.
m_new = PlexItem(rating_key="m_new", library_id=movie_lib.id, kind="movie", title="New Movie",
year=2001, added_at=_dt(1), genres=["Drama"], content_rating="PG")
m_prog = PlexItem(rating_key="m_prog", library_id=movie_lib.id, kind="movie", title="Prog Movie",
year=2002, added_at=_dt(2), genres=["Drama", "Comedy"], content_rating="PG-13")
m_watch = PlexItem(rating_key="m_watch", library_id=movie_lib.id, kind="movie", title="Watched Movie",
year=2003, added_at=_dt(3), genres=["Comedy"], content_rating="R")
m_hidden = PlexItem(rating_key="m_hidden", library_id=movie_lib.id, kind="movie", title="Hidden Movie",
year=2004, added_at=_dt(4), genres=["Drama"], content_rating="R")
m_new = PlexItem(
rating_key="m_new",
library_id=movie_lib.id,
kind="movie",
title="New Movie",
year=2001,
added_at=_dt(1),
genres=["Drama"],
content_rating="PG",
)
m_prog = PlexItem(
rating_key="m_prog",
library_id=movie_lib.id,
kind="movie",
title="Prog Movie",
year=2002,
added_at=_dt(2),
genres=["Drama", "Comedy"],
content_rating="PG-13",
)
m_watch = PlexItem(
rating_key="m_watch",
library_id=movie_lib.id,
kind="movie",
title="Watched Movie",
year=2003,
added_at=_dt(3),
genres=["Comedy"],
content_rating="R",
)
m_hidden = PlexItem(
rating_key="m_hidden",
library_id=movie_lib.id,
kind="movie",
title="Hidden Movie",
year=2004,
added_at=_dt(4),
genres=["Drama"],
content_rating="R",
)
# Shows — new / in-progress / watched (state comes from the episodes below).
sh_new = PlexShow(rating_key="sh_new", library_id=show_lib.id, title="New Show", year=2005,
added_at=_dt(5), child_count=1, genres=["Sci-Fi"], content_rating="TV-14")
sh_prog = PlexShow(rating_key="sh_prog", library_id=show_lib.id, title="Prog Show", year=2006,
added_at=_dt(6), child_count=1, genres=["Sci-Fi", "Drama"], content_rating="TV-MA")
sh_watch = PlexShow(rating_key="sh_watch", library_id=show_lib.id, title="Watched Show", year=2007,
added_at=_dt(7), child_count=1, genres=["Drama"], content_rating="TV-PG")
sh_new = PlexShow(
rating_key="sh_new",
library_id=show_lib.id,
title="New Show",
year=2005,
added_at=_dt(5),
child_count=1,
genres=["Sci-Fi"],
content_rating="TV-14",
)
sh_prog = PlexShow(
rating_key="sh_prog",
library_id=show_lib.id,
title="Prog Show",
year=2006,
added_at=_dt(6),
child_count=1,
genres=["Sci-Fi", "Drama"],
content_rating="TV-MA",
)
sh_watch = PlexShow(
rating_key="sh_watch",
library_id=show_lib.id,
title="Watched Show",
year=2007,
added_at=_dt(7),
child_count=1,
genres=["Drama"],
content_rating="TV-PG",
)
db.add_all([m_new, m_prog, m_watch, m_hidden, sh_new, sh_prog, sh_watch])
db.flush()
@@ -64,8 +121,17 @@ def _seed(db):
se = PlexSeason(rating_key=f"se_{rk}", show_id=show.id, season_number=1)
db.add(se)
db.flush()
ep = PlexItem(rating_key=rk, library_id=show_lib.id, kind="episode", title=f"Ep {rk}",
show_id=show.id, season_id=se.id, season_number=1, episode_number=n, added_at=_dt(day))
ep = PlexItem(
rating_key=rk,
library_id=show_lib.id,
kind="episode",
title=f"Ep {rk}",
show_id=show.id,
season_id=se.id,
season_number=1,
episode_number=n,
added_at=_dt(day),
)
db.add(ep)
db.flush()
return ep
@@ -78,13 +144,15 @@ def _seed(db):
user = User(email="plexparity@example.com")
db.add(user)
db.flush()
db.add_all([
PlexState(user_id=user.id, item_id=m_prog.id, position_seconds=120),
PlexState(user_id=user.id, item_id=m_watch.id, status="watched"),
PlexState(user_id=user.id, item_id=m_hidden.id, status="hidden"),
PlexState(user_id=user.id, item_id=e_prog.id, position_seconds=90),
PlexState(user_id=user.id, item_id=e_watch.id, status="watched"),
])
db.add_all(
[
PlexState(user_id=user.id, item_id=m_prog.id, position_seconds=120),
PlexState(user_id=user.id, item_id=m_watch.id, status="watched"),
PlexState(user_id=user.id, item_id=m_hidden.id, status="hidden"),
PlexState(user_id=user.id, item_id=e_prog.id, position_seconds=90),
PlexState(user_id=user.id, item_id=e_watch.id, status="watched"),
]
)
db.commit()
# rating_key -> (table, genres, content_rating) so the test can total the grid's visible set.
meta = {}