mirror of
https://github.com/A-Minos/nonebot-plugin-tetris-stats.git
synced 2026-03-05 05:36:54 +08:00
Some checks failed
Code Coverage / Test (macos-latest, 3.10) (push) Waiting to run
Code Coverage / Test (macos-latest, 3.11) (push) Waiting to run
Code Coverage / Test (macos-latest, 3.12) (push) Waiting to run
Code Coverage / Test (ubuntu-latest, 3.10) (push) Waiting to run
Code Coverage / Test (ubuntu-latest, 3.11) (push) Waiting to run
Code Coverage / Test (ubuntu-latest, 3.12) (push) Waiting to run
Code Coverage / Test (windows-latest, 3.10) (push) Waiting to run
Code Coverage / Test (windows-latest, 3.11) (push) Waiting to run
Code Coverage / Test (windows-latest, 3.12) (push) Waiting to run
Code Coverage / check (push) Blocked by required conditions
TypeCheck / TypeCheck (push) Waiting to run
CodeQL / Analyze (python) (push) Has been cancelled
* ⬆️ auto update by pre-commit hooks updates: - [github.com/astral-sh/ruff-pre-commit: v0.8.3 → v0.9.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.8.3...v0.9.6) * 🚨 auto fix by pre-commit hooks * ♻️ 重命名 typing 为 typedefs * ♻️ 使用 Annotated 代替默认值 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: shoucandanghehe <wallfjjd@gmail.com>
25 lines
548 B
Python
25 lines
548 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
|