This commit is contained in:
e4www
2026-01-30 16:34:56 +03:00
commit 12f2ceaf9b
27 changed files with 1331 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
from __future__ import annotations
from dataclasses import dataclass
from typing import Generic, TypeVar
TId = TypeVar("TId")
@dataclass(eq=False)
class Entity(Generic[TId]):
id: TId
def __eq__(self, other: object) -> bool:
if not isinstance(other, Entity):
return False
return self.id == other.id and self.__class__ is other.__class__
def __hash__(self) -> int:
return hash((self.__class__, self.id))