dnd-dm-toolkit/src/dnd_dm_toolkit/core/sentinel.py
2026-01-13 09:10:49 +03:00

17 lines
No EOL
470 B
Python

class _AllStatsSentinel:
"""Sentinel для обозначения 'любые навыки'"""
_instance = None
def __new__(cls):
if cls._instance is None:
cls._instance = super().__new__(cls)
return cls._instance
def __repr__(self):
return "ALL_STATS"
def __eq__(self, other: object) -> bool:
return isinstance(other, _AllStatsSentinel)
def __hash__(self) -> int:
return hash("ALL_STATS")