from typing import Generic, TypeVar from .asserts import * from .hashpoint import * from .origin import * from .rainbow_factory import * __all__ = ('MetaOrigin',) Mentioned = TypeVar('Mentioned') class MetaOrigin(Generic[Mentioned]): def origin(self, factory: RainbowFactory[Mentioned], point: bytes) -> Origin[Mentioned]: raise NotImplementedError def hash_point(self, factory: RainbowFactory[Mentioned], point: bytes) -> HashPoint[Mentioned]: assert isinstance(factory, RainbowFactory) assert isinstance(point, bytes) assert_eq(len(point), HashPoint.HASH_LENGTH) return HashPoint(point, self.origin(factory, point))