27 lines
698 B
Python
27 lines
698 B
Python
import abc
|
|
from typing import Type, TypeVar
|
|
|
|
from rainbowadn.core import *
|
|
|
|
from .istatic import *
|
|
|
|
__all__ = ('IAtomic',)
|
|
|
|
InlinedAtomic = TypeVar('InlinedAtomic')
|
|
|
|
|
|
class IAtomic(IStatic, abc.ABC):
|
|
def __topology_hash__(self) -> bytes:
|
|
return HashPoint.hash(b'')
|
|
|
|
@classmethod
|
|
def from_bytes(cls: Type[InlinedAtomic], source: bytes, resolver: HashResolver) -> InlinedAtomic:
|
|
assert issubclass(cls, IAtomic)
|
|
assert isinstance(source, bytes)
|
|
assert isinstance(resolver, HashResolver)
|
|
return cls._from_bytes(source)
|
|
|
|
@classmethod
|
|
def _from_bytes(cls: Type[InlinedAtomic], source: bytes) -> InlinedAtomic:
|
|
raise NotImplementedError
|