26 lines
779 B
Python
26 lines
779 B
Python
import abc
|
|
from typing import Type, TypeVar
|
|
|
|
from rainbowadn.core.hashpoint import HashPoint
|
|
from rainbowadn.core.hashresolver import HashResolver
|
|
from rainbowadn.core.static import StaticMentionable
|
|
|
|
__all__ = ('Atomic',)
|
|
|
|
AtomicMentioned = TypeVar('AtomicMentioned')
|
|
|
|
|
|
class Atomic(StaticMentionable, abc.ABC):
|
|
def __topology_hash__(self) -> bytes:
|
|
return HashPoint.hash(b'')
|
|
|
|
@classmethod
|
|
def from_bytes(cls: Type[AtomicMentioned], source: bytes, resolver: HashResolver) -> AtomicMentioned:
|
|
assert isinstance(source, bytes)
|
|
assert isinstance(resolver, HashResolver)
|
|
return cls._from_bytes(source)
|
|
|
|
@classmethod
|
|
def _from_bytes(cls: Type[AtomicMentioned], source: bytes) -> AtomicMentioned:
|
|
raise NotImplementedError
|