Resolve pre-existing ruff lint errors blocking CI

Five pre-existing lint errors on dev baseline (all introduced May 25-26
before this branch was cut) were blocking CI on this PR. Cleared as
courtesy fixes so the merge isn't gated on unrelated tech debt:

- web_server.py:22613 — F811 duplicate `urlparse` import inside
  `_parse_itunes_link_url` (already imported at module top, line 20).
  Removed from the inline `from urllib.parse import parse_qs, urlparse`;
  kept `parse_qs` since that one is only used here.
- core/listenbrainz_manager.py:746 — S110 silenced with
  `# noqa: S110 — best-effort lookup, delete proceeds either way`.
  Matches the existing project convention used in web_server.py:1693,
  core/watchlist/auto_scan.py:463, core/library_reorganize.py:548.
- core/playlists/sources/listenbrainz.py:236 — B905 `zip()` without
  explicit `strict=`. Added `strict=False` — preserves existing
  behaviour where `matched` can legitimately be shorter than
  `match_indices` on partial discover failure.
- core/playlists/sources/listenbrainz.py:273 — S110 silenced with
  `# noqa: S110 — caller falls back to last cached playlist on
  refresh failure`.
- core/playlists/sources/soulsync_discovery.py:105 — S110 silenced
  with `# noqa: S110 — manager persists last_generation_error on
  failure; surface existing snapshot`. The existing multi-line
  comment that already explained the swallow was rolled into the
  noqa justification so the rule + reason live on one line.

Ruff `python -m ruff check .` now passes; 664 discovery + metadata
tests still pass.
This commit is contained in:
Broque Thomas 2026-05-27 08:33:36 -07:00
parent 6125ef8834
commit 65d7756da2
4 changed files with 5 additions and 7 deletions

View file

@ -743,7 +743,7 @@ class ListenBrainzManager:
)
row = cursor.fetchone()
playlist_type = row[0] if row else ''
except Exception:
except Exception: # noqa: S110 — best-effort lookup, delete proceeds either way
pass
# Delete tracks first (SQLite FK CASCADE requires PRAGMA foreign_keys=ON)

View file

@ -233,7 +233,7 @@ class ListenBrainzPlaylistSource(PlaylistSource):
return tracks
out = list(tracks)
for slot_idx, result in zip(match_indices, matched):
for slot_idx, result in zip(match_indices, matched, strict=False):
if not result:
continue
track = out[slot_idx]
@ -270,7 +270,7 @@ class ListenBrainzPlaylistSource(PlaylistSource):
return None
try:
manager.update_all_playlists()
except Exception:
except Exception: # noqa: S110 — caller falls back to last cached playlist on refresh failure
pass
return self.get_playlist(playlist_id)

View file

@ -102,9 +102,7 @@ class SoulSyncDiscoveryPlaylistSource(PlaylistSource):
variant=record.variant,
profile_id=record.profile_id,
)
except Exception:
# Manager already persists ``last_generation_error`` on
# failure; surface the existing snapshot regardless.
except Exception: # noqa: S110 — manager persists last_generation_error on failure; surface existing snapshot
pass
return self.get_playlist(playlist_id)

View file

@ -22610,7 +22610,7 @@ _APPLE_MUSIC_BUNDLE_SCRAPE_CAP = 8
def _parse_itunes_link_url(url):
"""Return {'type': 'album'|'track'|'playlist', 'id': str} for supported Apple links."""
import re
from urllib.parse import parse_qs, urlparse
from urllib.parse import parse_qs
raw = (url or '').strip()
if not raw: