Skip to content

Commit 50e4d03

Browse files
committed
hooks: Generalise AlbumMatch and TrackMatch into Match
1 parent 02bb8ec commit 50e4d03

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

beets/autotag/hooks.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
from __future__ import annotations
1818

1919
from copy import deepcopy
20-
from typing import TYPE_CHECKING, Any, NamedTuple, TypeVar
20+
from dataclasses import dataclass
21+
from typing import TYPE_CHECKING, Any, TypeVar
2122

2223
from typing_extensions import Self
2324

@@ -214,10 +215,14 @@ def __init__(
214215

215216

216217
# Structures that compose all the information for a candidate match.
218+
@dataclass
219+
class Match:
220+
distance: Distance
221+
info: Info
217222

218223

219-
class AlbumMatch(NamedTuple):
220-
distance: Distance
224+
@dataclass
225+
class AlbumMatch(Match):
221226
info: AlbumInfo
222227
mapping: dict[Item, TrackInfo]
223228
extra_items: list[Item]
@@ -232,6 +237,6 @@ def items(self) -> list[Item]:
232237
return [i for i, _ in self.item_info_pairs]
233238

234239

235-
class TrackMatch(NamedTuple):
236-
distance: Distance
240+
@dataclass
241+
class TrackMatch(Match):
237242
info: TrackInfo

0 commit comments

Comments
 (0)