mirror of
https://github.com/baiqwerdvd/StarRailUID.git
synced 2025-05-07 12:43:25 +08:00
🐛 使用Union以支持低版本python
This commit is contained in:
parent
333541a361
commit
776e936119
@ -1,6 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TypedDict
|
||||
from typing import TypedDict, Union
|
||||
|
||||
|
||||
class MihomoData(TypedDict):
|
||||
@ -15,8 +15,8 @@ class Behavior(TypedDict):
|
||||
class Equipment(TypedDict):
|
||||
level: int
|
||||
tid: int
|
||||
promotion: int | None
|
||||
rank: int | None
|
||||
promotion: Union[int, None]
|
||||
rank: Union[int, None]
|
||||
|
||||
|
||||
class Relic(TypedDict):
|
||||
@ -34,19 +34,19 @@ class SubAffix(TypedDict):
|
||||
|
||||
class Avatar(TypedDict):
|
||||
skillTreeList: list[Behavior]
|
||||
rank: int | None
|
||||
pos: int | None
|
||||
rank: Union[int, None]
|
||||
pos: Union[int, None]
|
||||
avatarId: int
|
||||
level: int
|
||||
equipment: Equipment | None
|
||||
equipment: Union[Equipment, None]
|
||||
relicList: list[Relic]
|
||||
promotion: int
|
||||
|
||||
|
||||
class Challenge(TypedDict):
|
||||
scheduleMaxLevel: int
|
||||
MazeGroupIndex: int | None
|
||||
PreMazeGroupIndex: int | None
|
||||
MazeGroupIndex: Union[int, None]
|
||||
PreMazeGroupIndex: Union[int, None]
|
||||
|
||||
|
||||
class PlayerSpaceInfo(TypedDict):
|
||||
@ -61,13 +61,13 @@ class PlayerDetailInfo(TypedDict):
|
||||
assistAvatarDetail: Avatar
|
||||
platform: str
|
||||
isDisplayAvatar: bool
|
||||
avatarDetailList: list[Avatar] | None
|
||||
avatarDetailList: Union[list[Avatar], None]
|
||||
uid: int
|
||||
friendCount: int
|
||||
worldLevel: int
|
||||
nickname: str
|
||||
Birthday: int | None
|
||||
Birthday: Union[int, None]
|
||||
level: int
|
||||
recordInfo: PlayerSpaceInfo | None
|
||||
recordInfo: Union[PlayerSpaceInfo, None]
|
||||
headIcon: int
|
||||
signature: str | None
|
||||
signature: Union[str, None]
|
||||
|
@ -1,4 +1,4 @@
|
||||
from typing import Any, Dict, List, Optional, TypedDict
|
||||
from typing import Any, Dict, List, TypedDict, Union
|
||||
|
||||
################
|
||||
# 抽卡记录相关 #
|
||||
@ -91,8 +91,8 @@ class RogueRecordInfo(TypedDict):
|
||||
miracles: List[RogueMiracles]
|
||||
difficulty: int
|
||||
progress: int
|
||||
detail_h: Optional[int]
|
||||
start_h: Optional[int]
|
||||
detail_h: Union[int, None]
|
||||
start_h: Union[int, None]
|
||||
|
||||
|
||||
class RogueBasic(TypedDict):
|
||||
@ -373,7 +373,7 @@ class AvatarListItemDetail(TypedDict):
|
||||
rarity: int
|
||||
rank: int
|
||||
image: str
|
||||
equip: Optional[Equip]
|
||||
equip: Union[Equip, None]
|
||||
relics: List[RelicsItem]
|
||||
ornaments: List
|
||||
ranks: List[RanksItem]
|
||||
|
@ -29,7 +29,7 @@ async def convert_img(img: Path, is_base64: bool = False) -> str:
|
||||
|
||||
async def convert_img(
|
||||
img: Union[Image.Image, str, Path, bytes], is_base64: bool = False
|
||||
) -> str | bytes:
|
||||
) -> Union[str, bytes]:
|
||||
"""
|
||||
:说明:
|
||||
将PIL.Image对象转换为bytes或者base64格式。
|
||||
|
@ -1,6 +1,6 @@
|
||||
import asyncio
|
||||
from pathlib import Path
|
||||
from typing import Dict, List, Tuple
|
||||
from typing import Dict, List, Tuple, Union
|
||||
|
||||
from aiohttp.client import ClientSession
|
||||
from msgspec import json as msgjson
|
||||
@ -15,7 +15,7 @@ with Path.open(
|
||||
) as f:
|
||||
resource_map = msgjson.decode(
|
||||
f.read(),
|
||||
type=Dict[str, Dict[str, Dict[str, Dict[str, str | int]]]],
|
||||
type=Dict[str, Dict[str, Dict[str, Dict[str, Union[str, int]]]]],
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user