mirror of
https://github.com/A-Minos/nonebot-plugin-tetris-stats.git
synced 2026-03-05 05:36:54 +08:00
⏪ Revert "✨ 为使用了 alias 的 pydantic model 设置 populate_by_name"
This reverts commit 17690e673f.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
from nonebot.compat import PYDANTIC_V2
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from ..typing import Rank
|
||||
from .base import FailedModel
|
||||
@@ -14,12 +13,6 @@ class _User(BaseModel):
|
||||
supporter: bool
|
||||
verified: bool
|
||||
country: str | None = None
|
||||
if PYDANTIC_V2:
|
||||
model_config = ConfigDict(populate_by_name=True)
|
||||
else:
|
||||
|
||||
class Config:
|
||||
allow_population_by_field_name = True
|
||||
|
||||
|
||||
class SuccessModel(BaseSuccessModel):
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
from datetime import datetime
|
||||
from typing import Literal
|
||||
|
||||
from nonebot.compat import PYDANTIC_V2
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from ..typing import Rank
|
||||
from .base import FailedModel
|
||||
@@ -114,12 +113,6 @@ class SuccessModel(BaseSuccessModel):
|
||||
connections: Connections
|
||||
friend_count: int | None = None
|
||||
distinguishment: Distinguishment | None = None
|
||||
if PYDANTIC_V2:
|
||||
model_config = ConfigDict(populate_by_name=True)
|
||||
else:
|
||||
|
||||
class Config:
|
||||
allow_population_by_field_name = True
|
||||
|
||||
user: User
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from datetime import datetime
|
||||
|
||||
from nonebot.compat import PYDANTIC_V2
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from .base import FailedModel
|
||||
from .base import SuccessModel as BaseSuccessModel
|
||||
@@ -67,23 +66,11 @@ class EndContext(BaseModel):
|
||||
finesse: Finesse
|
||||
final_time: float = Field(..., alias='finalTime')
|
||||
gametype: str
|
||||
if PYDANTIC_V2:
|
||||
model_config = ConfigDict(populate_by_name=True)
|
||||
else:
|
||||
|
||||
class Config:
|
||||
allow_population_by_field_name = True
|
||||
|
||||
|
||||
class _User(BaseModel):
|
||||
id: str = Field(..., alias='_id')
|
||||
username: str
|
||||
if PYDANTIC_V2:
|
||||
model_config = ConfigDict(populate_by_name=True)
|
||||
else:
|
||||
|
||||
class Config:
|
||||
allow_population_by_field_name = True
|
||||
|
||||
|
||||
class _Record(BaseModel):
|
||||
@@ -93,12 +80,6 @@ class _Record(BaseModel):
|
||||
user: _User
|
||||
ts: datetime
|
||||
ismulti: bool | None = None
|
||||
if PYDANTIC_V2:
|
||||
model_config = ConfigDict(populate_by_name=True)
|
||||
else:
|
||||
|
||||
class Config:
|
||||
allow_population_by_field_name = True
|
||||
|
||||
|
||||
class BaseModeRecord(BaseModel):
|
||||
@@ -121,12 +102,6 @@ class SuccessModel(BaseSuccessModel):
|
||||
|
||||
sprint: Sprint = Field(..., alias='40l')
|
||||
blitz: Blitz
|
||||
if PYDANTIC_V2:
|
||||
model_config = ConfigDict(populate_by_name=True)
|
||||
else:
|
||||
|
||||
class Config:
|
||||
allow_population_by_field_name = True
|
||||
|
||||
class Zen(BaseModel):
|
||||
level: int
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
from datetime import datetime
|
||||
from typing import Literal
|
||||
|
||||
from nonebot.compat import PYDANTIC_V2
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class SuccessModel(BaseModel):
|
||||
@@ -17,12 +16,6 @@ class SuccessModel(BaseModel):
|
||||
win: str
|
||||
lose: str
|
||||
score: str
|
||||
if PYDANTIC_V2:
|
||||
model_config = ConfigDict(populate_by_name=True)
|
||||
else:
|
||||
|
||||
class Config:
|
||||
allow_population_by_field_name = True
|
||||
|
||||
class UserDataTotalItem(BaseModel):
|
||||
time_map: str = Field(..., alias='timeMap')
|
||||
@@ -55,12 +48,6 @@ class SuccessModel(BaseModel):
|
||||
tspin_no_map: str = Field(..., alias='tspinNoMap')
|
||||
b2b_no_map: str = Field(..., alias='b2bNoMap')
|
||||
perfect_clear_no_map: str = Field(..., alias='perfectClearNoMap')
|
||||
if PYDANTIC_V2:
|
||||
model_config = ConfigDict(populate_by_name=True)
|
||||
else:
|
||||
|
||||
class Config:
|
||||
allow_population_by_field_name = True
|
||||
|
||||
teaid: str = Field(..., alias='teaId')
|
||||
name: str
|
||||
@@ -85,13 +72,6 @@ class SuccessModel(BaseModel):
|
||||
register_date: datetime = Field(..., alias='registerDate')
|
||||
last_login_date: datetime = Field(..., alias='lastLoginDate')
|
||||
|
||||
if PYDANTIC_V2:
|
||||
model_config = ConfigDict(populate_by_name=True)
|
||||
else:
|
||||
|
||||
class Config:
|
||||
allow_population_by_field_name = True
|
||||
|
||||
code: int
|
||||
success: Literal[True]
|
||||
data: Data
|
||||
|
||||
Reference in New Issue
Block a user