File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change 1717from __future__ import annotations
1818
1919from copy import deepcopy
20- from typing import TYPE_CHECKING , Any , NamedTuple , TypeVar
20+ from dataclasses import dataclass
21+ from functools import cached_property
22+ from typing import TYPE_CHECKING , Any , TypeVar
2123
2224from typing_extensions import Self
2325
@@ -214,20 +216,24 @@ def __init__(
214216
215217
216218# Structures that compose all the information for a candidate match.
219+ @dataclass
220+ class Match :
221+ distance : Distance
222+ info : Info
217223
218224
219- class AlbumMatch ( NamedTuple ):
220- distance : Distance
225+ @ dataclass
226+ class AlbumMatch ( Match ):
221227 info : AlbumInfo
222228 mapping : list [tuple [Item , TrackInfo ]]
223229 extra_items : list [Item ]
224230 extra_tracks : list [TrackInfo ]
225231
226- @property
232+ @cached_property
227233 def items (self ) -> list [Item ]:
228234 return [i for i , _ in self .mapping ]
229235
230236
231- class TrackMatch ( NamedTuple ):
232- distance : Distance
237+ @ dataclass
238+ class TrackMatch ( Match ):
233239 info : TrackInfo
You can’t perform that action at this time.
0 commit comments