Skip to content

Commit 783cab2

Browse files
jeffcrouseclaude
andcommitted
fix: type errors in redis operations and unused catch parameter
- Add type annotations for redis.get() calls to satisfy mypy - Remove unused 'err' catch parameter in LibraryManagement.tsx - Cast features to dict[str, Any] for musicbrainz metadata 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 6cb618d commit 783cab2

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

backend/app/services/background.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def is_scan_running(self) -> bool:
126126

127127
# Also check Redis for stale progress
128128
try:
129-
data = self.redis.get("familiar:scan:progress")
129+
data: bytes | None = self.redis.get("familiar:scan:progress") # type: ignore[assignment]
130130
if data:
131131
progress = json.loads(data)
132132
return progress.get("status") == "running"

backend/app/services/tasks.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def get_recent_failures(limit: int = 10) -> list[dict[str, Any]]:
5757
"""Get recent task failures from Redis."""
5858
try:
5959
r = get_redis()
60-
failures = r.lrange(TASK_FAILURES_KEY, 0, limit - 1)
60+
failures: list[bytes] = r.lrange(TASK_FAILURES_KEY, 0, limit - 1) # type: ignore[assignment]
6161
return [json.loads(f) for f in failures]
6262
except Exception:
6363
return []
@@ -171,7 +171,7 @@ def set_cleanup(self, marked_missing: int, still_missing: int = 0) -> None:
171171

172172
def _get_current(self) -> dict[str, Any]:
173173
"""Get current progress from Redis."""
174-
data = self.redis.get(SCAN_PROGRESS_KEY)
174+
data: bytes | None = self.redis.get(SCAN_PROGRESS_KEY) # type: ignore[assignment]
175175
if data:
176176
return json.loads(data)
177177
return {}
@@ -223,7 +223,7 @@ def get_scan_progress() -> dict[str, Any] | None:
223223
"""Get current scan progress from Redis."""
224224
try:
225225
r = get_redis()
226-
data = r.get(SCAN_PROGRESS_KEY)
226+
data: bytes | None = r.get(SCAN_PROGRESS_KEY) # type: ignore[assignment]
227227
if data:
228228
return json.loads(data)
229229
except Exception as e:
@@ -371,7 +371,7 @@ def run_track_analysis(track_id: str) -> dict[str, Any]:
371371
)
372372

373373
# Extract audio features with librosa
374-
features = extract_features(file_path)
374+
features: dict[str, Any] = extract_features(file_path)
375375

376376
# Generate CLAP embedding for similarity search
377377
embedding = extract_embedding(file_path)
@@ -581,7 +581,7 @@ def _update_progress(self, data: dict[str, Any]) -> None:
581581

582582
def _get_current(self) -> dict[str, Any]:
583583
"""Get current progress from Redis."""
584-
data = self.redis.get(SPOTIFY_SYNC_PROGRESS_KEY)
584+
data: bytes | None = self.redis.get(SPOTIFY_SYNC_PROGRESS_KEY) # type: ignore[assignment]
585585
if data:
586586
return json.loads(data)
587587
return {}
@@ -664,7 +664,7 @@ def get_spotify_sync_progress() -> dict[str, Any] | None:
664664
"""Get current Spotify sync progress from Redis."""
665665
try:
666666
r = get_redis()
667-
data = r.get(SPOTIFY_SYNC_PROGRESS_KEY)
667+
data: bytes | None = r.get(SPOTIFY_SYNC_PROGRESS_KEY) # type: ignore[assignment]
668668
if data:
669669
return json.loads(data)
670670
except Exception as e:
@@ -949,7 +949,7 @@ def _update_progress(self, data: dict[str, Any]) -> None:
949949
self.redis.set(NEW_RELEASES_PROGRESS_KEY, json.dumps(data), ex=3600)
950950

951951
def _get_current(self) -> dict[str, Any]:
952-
data = self.redis.get(NEW_RELEASES_PROGRESS_KEY)
952+
data: bytes | None = self.redis.get(NEW_RELEASES_PROGRESS_KEY) # type: ignore[assignment]
953953
if data:
954954
return json.loads(data)
955955
return {}
@@ -1006,7 +1006,7 @@ def get_new_releases_progress() -> dict[str, Any] | None:
10061006
"""Get current new releases check progress from Redis."""
10071007
try:
10081008
r = get_redis()
1009-
data = r.get(NEW_RELEASES_PROGRESS_KEY)
1009+
data: bytes | None = r.get(NEW_RELEASES_PROGRESS_KEY) # type: ignore[assignment]
10101010
if data:
10111011
return json.loads(data)
10121012
except Exception as e:

frontend/src/components/Admin/LibraryManagement.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export function LibraryManagement() {
138138
setError(data.detail || 'Failed to start scan');
139139
setScanning(false);
140140
}
141-
} catch (err) {
141+
} catch {
142142
setError('Failed to start scan');
143143
setScanning(false);
144144
}

0 commit comments

Comments
 (0)