mirror of
https://github.com/A-Minos/nonebot-plugin-tetris-stats.git
synced 2026-02-03 18:45:32 +08:00
* ⬆️ auto update by pre-commit hooks updates: - [github.com/astral-sh/ruff-pre-commit: v0.11.13 → v0.12.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.13...v0.12.3) * 🚨 auto fix by pre-commit hooks * ⬆️ Upgrade dependency ruff to v0.12.4 * 🚨 修复 lint 警告 * 🚨 添加一个 noqa( --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: 呵呵です <51957264+shoucandanghehe@users.noreply.github.com> Co-authored-by: shoucandanghehe <wallfjjd@gmail.com>
27 lines
583 B
Python
27 lines
583 B
Python
from abc import ABC, abstractmethod
|
|
from typing import Generic, TypeVar
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from ..utils.typedefs import GameType
|
|
|
|
T = TypeVar('T', bound=GameType)
|
|
|
|
|
|
class BaseUser(BaseModel, ABC, Generic[T]):
|
|
"""游戏用户"""
|
|
|
|
platform: T
|
|
|
|
def __eq__(self, other: object) -> bool:
|
|
if isinstance(other, BaseUser):
|
|
return self.unique_identifier == other.unique_identifier
|
|
return False
|
|
|
|
@property
|
|
@abstractmethod
|
|
def unique_identifier(self) -> str:
|
|
raise NotImplementedError
|
|
|
|
__hash__ = BaseModel.__hash__
|