fix typing across multiple games, fixes #23

This commit is contained in:
Hay1tsme 2023-07-05 10:47:43 -04:00
parent da422e602b
commit d60f827000
8 changed files with 20 additions and 20 deletions

View File

@ -4,7 +4,7 @@ from datetime import datetime, timedelta
from time import strftime from time import strftime
import pytz import pytz
from typing import Dict, Any from typing import Dict, Any, List
from core.config import CoreConfig from core.config import CoreConfig
from titles.chuni.const import ChuniConstants from titles.chuni.const import ChuniConstants
@ -401,7 +401,7 @@ class ChuniBase:
"userItemList": [], "userItemList": [],
} }
items: list[Dict[str, Any]] = [] items: List[Dict[str, Any]] = []
for i in range(next_idx, len(user_item_list)): for i in range(next_idx, len(user_item_list)):
tmp = user_item_list[i]._asdict() tmp = user_item_list[i]._asdict()
tmp.pop("user") tmp.pop("user")

View File

@ -296,7 +296,7 @@ class ChuniItemData(BaseData):
self, self,
version: int, version: int,
room_id: int, room_id: int,
matching_member_info_list: list, matching_member_info_list: List,
user_id: int = None, user_id: int = None,
rest_sec: int = 60, rest_sec: int = 60,
is_full: bool = False is_full: bool = False

View File

@ -2,7 +2,7 @@ import logging
import json import json
from decimal import Decimal from decimal import Decimal
from base64 import b64encode from base64 import b64encode
from typing import Any, Dict from typing import Any, Dict, List
from hashlib import md5 from hashlib import md5
from datetime import datetime from datetime import datetime
@ -416,7 +416,7 @@ class CxbBase:
self.logger.info(f"Get best rankings for {uid}") self.logger.info(f"Get best rankings for {uid}")
p = self.data.score.get_best_rankings(uid) p = self.data.score.get_best_rankings(uid)
rankList: list[Dict[str, Any]] = [] rankList: List[Dict[str, Any]] = []
for rank in p: for rank in p:
if rank["song_id"] is not None: if rank["song_id"] is not None:

View File

@ -1,5 +1,5 @@
from datetime import datetime, date, timedelta from datetime import datetime, date, timedelta
from typing import Any, Dict from typing import Any, Dict, List
import logging import logging
from core.config import CoreConfig from core.config import CoreConfig
@ -466,7 +466,7 @@ class Mai2Base:
next_idx = int(data["nextIndex"] % 10000000000) next_idx = int(data["nextIndex"] % 10000000000)
user_item_list = self.data.item.get_items(data["userId"], kind) user_item_list = self.data.item.get_items(data["userId"], kind)
items: list[Dict[str, Any]] = [] items: List[Dict[str, Any]] = []
for i in range(next_idx, len(user_item_list)): for i in range(next_idx, len(user_item_list)):
tmp = user_item_list[i]._asdict() tmp = user_item_list[i]._asdict()
tmp.pop("user") tmp.pop("user")

View File

@ -320,7 +320,7 @@ class Mai2DX(Mai2Base):
next_idx = int(data["nextIndex"] % 10000000000) next_idx = int(data["nextIndex"] % 10000000000)
user_item_list = self.data.item.get_items(data["userId"], kind) user_item_list = self.data.item.get_items(data["userId"], kind)
items: list[Dict[str, Any]] = [] items: List[Dict[str, Any]] = []
for i in range(next_idx, len(user_item_list)): for i in range(next_idx, len(user_item_list)):
tmp = user_item_list[i]._asdict() tmp = user_item_list[i]._asdict()
tmp.pop("user") tmp.pop("user")

View File

@ -180,7 +180,7 @@ class Mai2Universe(Mai2DX):
extend = extend._asdict() extend = extend._asdict()
# parse the selectedCardList # parse the selectedCardList
# 6 = Freedom Pass, 4 = Gold Pass (cardTypeId) # 6 = Freedom Pass, 4 = Gold Pass (cardTypeId)
selected_cards: list = extend["selectedCardList"] selected_cards: List = extend["selectedCardList"]
# if no pass is already added, add the corresponding pass # if no pass is already added, add the corresponding pass
if not user_card["cardTypeId"] in selected_cards: if not user_card["cardTypeId"] in selected_cards:

View File

@ -268,7 +268,7 @@ class OngekiBase:
} }
def handle_get_game_id_list_api_request(self, data: Dict) -> Dict: def handle_get_game_id_list_api_request(self, data: Dict) -> Dict:
game_idlist: list[str, Any] = [] # 1 to 230 & 8000 to 8050 game_idlist: List[str, Any] = [] # 1 to 230 & 8000 to 8050
if data["type"] == 1: if data["type"] == 1:
for i in range(1, 231): for i in range(1, 231):
@ -443,7 +443,7 @@ class OngekiBase:
"userItemList": [], "userItemList": [],
} }
items: list[Dict[str, Any]] = [] items: List[Dict[str, Any]] = []
for i in range(data["nextIndex"] % 10000000000, len(p)): for i in range(data["nextIndex"] % 10000000000, len(p)):
if len(items) > data["maxCount"]: if len(items) > data["maxCount"]:
break break

View File

@ -8,12 +8,12 @@ from titles.wacca.handlers.helpers import Notice
class GetNewsResponseV1(BaseResponse): class GetNewsResponseV1(BaseResponse):
def __init__(self) -> None: def __init__(self) -> None:
super().__init__() super().__init__()
self.notices: list[Notice] = [] self.notices: List[Notice] = []
self.copywrightListings: list[str] = [] self.copywrightListings: List[str] = []
self.stoppedSongs: list[int] = [] self.stoppedSongs: List[int] = []
self.stoppedJackets: list[int] = [] self.stoppedJackets: List[int] = []
self.stoppedMovies: list[int] = [] self.stoppedMovies: List[int] = []
self.stoppedIcons: list[int] = [] self.stoppedIcons: List[int] = []
def make(self) -> Dict: def make(self) -> Dict:
note = [] note = []
@ -34,7 +34,7 @@ class GetNewsResponseV1(BaseResponse):
class GetNewsResponseV2(GetNewsResponseV1): class GetNewsResponseV2(GetNewsResponseV1):
stoppedProducts: list[int] = [] stoppedProducts: List[int] = []
def make(self) -> Dict: def make(self) -> Dict:
super().make() super().make()
@ -44,8 +44,8 @@ class GetNewsResponseV2(GetNewsResponseV1):
class GetNewsResponseV3(GetNewsResponseV2): class GetNewsResponseV3(GetNewsResponseV2):
stoppedNavs: list[int] = [] stoppedNavs: List[int] = []
stoppedNavVoices: list[int] = [] stoppedNavVoices: List[int] = []
def make(self) -> Dict: def make(self) -> Dict:
super().make() super().make()