2022-12-17 21:52:34 +01:00
|
|
|
import typing as t
|
|
|
|
|
|
|
|
T = t.TypeVar("T")
|
|
|
|
|
|
|
|
|
|
|
|
class BaseDataset(t.Generic[T]):
|
|
|
|
'''Base dataset class.'''
|
|
|
|
|
2022-12-18 01:31:41 +01:00
|
|
|
def __iter__(self) -> t.Generator[T, None, None]:
|
2022-12-17 21:52:34 +01:00
|
|
|
'''Implements the basic iterator interface.'''
|
|
|
|
return self.generator()
|
|
|
|
|
|
|
|
def generator(self) -> t.Generator[T, None, None]:
|
|
|
|
'''Should yield individual items from the dataset.'''
|
|
|
|
raise NotImplementedError
|