rainbowadn/rainbowadn/hashing/nullability/notnull.py
2022-05-08 21:56:17 +03:00

19 lines
460 B
Python

from typing import Generic, TypeVar
from rainbowadn.hashing.nullability.nullable import Nullable
__all__ = ('NotNull',)
NullableType = TypeVar('NullableType')
class NotNull(Nullable[NullableType], Generic[NullableType]):
def __init__(self, value: NullableType):
self.value = value
def __eq__(self, other):
if isinstance(other, NotNull):
return self.value == other.value
else:
return NotImplemented