style: Format with black 24.x.x

This commit is contained in:
xtaodada 2024-03-29 22:24:11 +08:00
parent 07403cf093
commit e1fe087e2a
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 27 additions and 5 deletions

View File

@ -33,6 +33,8 @@ async def fetch_light_cones():
try:
await get_single_light_cone(f"{light_cone_yatta_url}/{light_cone_id}")
except ValidationError:
print(f"{light_cone_yatta_url}/{light_cone_id} 获取光锥数据失败,数据格式异常")
print(
f"{light_cone_yatta_url}/{light_cone_id} 获取光锥数据失败,数据格式异常"
)
print("获取光锥数据完成")
await dump_light_cones()

View File

@ -10,7 +10,14 @@ from models.head_icon import HeadIcon, ItemPlayerCard, PlayerIcon, AvatarPlayerI
from .avatar import load_icons
from .base_data import get_base_data
from .client import client
from .url import avatar_player_icon_url, player_icon_url, item_player_card_url, text_map, icons_url, base_enka_url
from .url import (
avatar_player_icon_url,
player_icon_url,
item_player_card_url,
text_map,
icons_url,
base_enka_url,
)
data_path = Path("data")
@ -63,7 +70,9 @@ async def test_enka_url(path: str) -> str:
return url
async def extra_head_icons(item_player_card: List[ItemPlayerCard], player_icon: List[PlayerIcon]) -> List[HeadIcon]:
async def extra_head_icons(
item_player_card: List[ItemPlayerCard], player_icon: List[PlayerIcon]
) -> List[HeadIcon]:
player_icon_map: Dict[int, PlayerIcon] = {i.ID: i for i in player_icon}
text_map_ = await get_text_map()
station_urls = await parse_station_urls()
@ -79,7 +88,9 @@ async def extra_head_icons(item_player_card: List[ItemPlayerCard], player_icon:
station_url = station_urls.get(name, "")
enka_url = await test_enka_url(icon)
icons = [station_url, enka_url]
datas.append(HeadIcon(id=id_, name=name, desc=desc, bg_desc=bg_desc, icons=icons))
datas.append(
HeadIcon(id=id_, name=name, desc=desc, bg_desc=bg_desc, icons=icons)
)
return datas
@ -100,7 +111,16 @@ async def avatar_head_icons(avatar_player_icon: List[AvatarPlayerIcon]):
station_url = avatar.icon_ or ""
enka_url = await test_enka_url(i.ImagePath)
icons = [station_url, enka_url]
datas.append(HeadIcon(id=i.ID, name=name, desc="", bg_desc="", avatar_id=i.AvatarID, icons=icons))
datas.append(
HeadIcon(
id=i.ID,
name=name,
desc="",
bg_desc="",
avatar_id=i.AvatarID,
icons=icons,
)
)
return datas