-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f144ac
commit 0d58945
Showing
9 changed files
with
93 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 4 additions & 19 deletions
23
nonebot_plugin_tetris_stats/game_data_processor/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
nonebot_plugin_tetris_stats/game_data_processor/io_data_processor/schemas/response.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from ... import ProcessedData as ProcessedDataMeta | ||
from ... import RawResponse as RawResponseMeta | ||
from .user_info import SuccessModel as InfoSuccess | ||
from .user_records import SuccessModel as RecordsSuccess | ||
|
||
|
||
class RawResponse(RawResponseMeta): | ||
user_info: bytes | None = None | ||
user_records: bytes | None = None | ||
|
||
|
||
class ProcessedData(ProcessedDataMeta): | ||
user_info: InfoSuccess | None = None | ||
user_records: RecordsSuccess | None = None |
24 changes: 24 additions & 0 deletions
24
nonebot_plugin_tetris_stats/game_data_processor/schemas.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from abc import ABC, abstractmethod | ||
from typing import Self | ||
|
||
from pydantic import BaseModel | ||
|
||
|
||
class BaseUser(ABC, BaseModel): | ||
"""游戏用户""" | ||
|
||
def __eq__(self, __value: Self) -> bool: | ||
return self.unique_identifier == __value.unique_identifier | ||
|
||
@property | ||
@abstractmethod | ||
def unique_identifier(self) -> str: | ||
raise NotImplementedError | ||
|
||
|
||
class BaseRawResponse(BaseModel): | ||
"""原始请求数据""" | ||
|
||
|
||
class BaseProcessedData(BaseModel): | ||
"""处理/验证后的数据""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
nonebot_plugin_tetris_stats/game_data_processor/top_data_processor/schemas/response.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from ...schemas import BaseProcessedData, BaseRawResponse | ||
|
||
|
||
class RawResponse(BaseRawResponse): | ||
user_profile: bytes | None = None | ||
|
||
|
||
class ProcessedData(BaseProcessedData): | ||
user_profile: str | None = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
nonebot_plugin_tetris_stats/game_data_processor/tos_data_processor/schemas/response.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from ...schemas import BaseProcessedData, BaseRawResponse | ||
from .user_info import SuccessModel as InfoSuccess | ||
from .user_profile import UserProfile | ||
|
||
|
||
class RawResponse(BaseRawResponse): | ||
user_profile: dict[frozenset[tuple[str, str | bytes]], bytes] | ||
user_info: bytes | None = None | ||
|
||
|
||
class ProcessedData(BaseProcessedData): | ||
user_profile: dict[frozenset[tuple[str, str | bytes]], UserProfile] | ||
user_info: InfoSuccess | None = None |