feat(discovery): SimilaritySource protocol + FakeSimilaritySource
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
from dataclasses import dataclass
|
||||
from typing import Protocol, runtime_checkable
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class SimilarArtist:
|
||||
mbid: str
|
||||
name: str
|
||||
score: float
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
class SimilaritySource(Protocol):
|
||||
name: str
|
||||
|
||||
def health(self) -> bool:
|
||||
"""Is this source reachable right now?"""
|
||||
...
|
||||
|
||||
def similar_artists(self, mbid: str) -> list[SimilarArtist]:
|
||||
"""Artists similar to the given artist MBID (MBID-native)."""
|
||||
...
|
||||
Reference in New Issue
Block a user