From d60f8270009d9e53a0fe215703ef5a11649f7c5e Mon Sep 17 00:00:00 2001 From: Hay1tsme Date: Wed, 5 Jul 2023 10:47:43 -0400 Subject: [PATCH] fix typing across multiple games, fixes #23 --- titles/chuni/base.py | 4 ++-- titles/chuni/schema/item.py | 2 +- titles/cxb/base.py | 4 ++-- titles/mai2/base.py | 4 ++-- titles/mai2/dx.py | 2 +- titles/mai2/universe.py | 2 +- titles/ongeki/base.py | 4 ++-- titles/wacca/handlers/advertise.py | 18 +++++++++--------- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/titles/chuni/base.py b/titles/chuni/base.py index 689c2fe..ed8d0fb 100644 --- a/titles/chuni/base.py +++ b/titles/chuni/base.py @@ -4,7 +4,7 @@ from datetime import datetime, timedelta from time import strftime import pytz -from typing import Dict, Any +from typing import Dict, Any, List from core.config import CoreConfig from titles.chuni.const import ChuniConstants @@ -401,7 +401,7 @@ class ChuniBase: "userItemList": [], } - items: list[Dict[str, Any]] = [] + items: List[Dict[str, Any]] = [] for i in range(next_idx, len(user_item_list)): tmp = user_item_list[i]._asdict() tmp.pop("user") diff --git a/titles/chuni/schema/item.py b/titles/chuni/schema/item.py index 94c4fd8..47ff633 100644 --- a/titles/chuni/schema/item.py +++ b/titles/chuni/schema/item.py @@ -296,7 +296,7 @@ class ChuniItemData(BaseData): self, version: int, room_id: int, - matching_member_info_list: list, + matching_member_info_list: List, user_id: int = None, rest_sec: int = 60, is_full: bool = False diff --git a/titles/cxb/base.py b/titles/cxb/base.py index 6b6a5d5..749e8ac 100644 --- a/titles/cxb/base.py +++ b/titles/cxb/base.py @@ -2,7 +2,7 @@ import logging import json from decimal import Decimal from base64 import b64encode -from typing import Any, Dict +from typing import Any, Dict, List from hashlib import md5 from datetime import datetime @@ -416,7 +416,7 @@ class CxbBase: self.logger.info(f"Get best rankings for {uid}") p = self.data.score.get_best_rankings(uid) - rankList: list[Dict[str, Any]] = [] + rankList: List[Dict[str, Any]] = [] for rank in p: if rank["song_id"] is not None: diff --git a/titles/mai2/base.py b/titles/mai2/base.py index 9f1ffaf..ad9aafd 100644 --- a/titles/mai2/base.py +++ b/titles/mai2/base.py @@ -1,5 +1,5 @@ from datetime import datetime, date, timedelta -from typing import Any, Dict +from typing import Any, Dict, List import logging from core.config import CoreConfig @@ -466,7 +466,7 @@ class Mai2Base: next_idx = int(data["nextIndex"] % 10000000000) 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)): tmp = user_item_list[i]._asdict() tmp.pop("user") diff --git a/titles/mai2/dx.py b/titles/mai2/dx.py index 266332e..971135d 100644 --- a/titles/mai2/dx.py +++ b/titles/mai2/dx.py @@ -320,7 +320,7 @@ class Mai2DX(Mai2Base): next_idx = int(data["nextIndex"] % 10000000000) 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)): tmp = user_item_list[i]._asdict() tmp.pop("user") diff --git a/titles/mai2/universe.py b/titles/mai2/universe.py index f5b2515..f57ae1e 100644 --- a/titles/mai2/universe.py +++ b/titles/mai2/universe.py @@ -180,7 +180,7 @@ class Mai2Universe(Mai2DX): extend = extend._asdict() # parse the selectedCardList # 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 not user_card["cardTypeId"] in selected_cards: diff --git a/titles/ongeki/base.py b/titles/ongeki/base.py index 4f7619c..f10353c 100644 --- a/titles/ongeki/base.py +++ b/titles/ongeki/base.py @@ -268,7 +268,7 @@ class OngekiBase: } 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: for i in range(1, 231): @@ -443,7 +443,7 @@ class OngekiBase: "userItemList": [], } - items: list[Dict[str, Any]] = [] + items: List[Dict[str, Any]] = [] for i in range(data["nextIndex"] % 10000000000, len(p)): if len(items) > data["maxCount"]: break diff --git a/titles/wacca/handlers/advertise.py b/titles/wacca/handlers/advertise.py index 56186eb..47c8406 100644 --- a/titles/wacca/handlers/advertise.py +++ b/titles/wacca/handlers/advertise.py @@ -8,12 +8,12 @@ from titles.wacca.handlers.helpers import Notice class GetNewsResponseV1(BaseResponse): def __init__(self) -> None: super().__init__() - self.notices: list[Notice] = [] - self.copywrightListings: list[str] = [] - self.stoppedSongs: list[int] = [] - self.stoppedJackets: list[int] = [] - self.stoppedMovies: list[int] = [] - self.stoppedIcons: list[int] = [] + self.notices: List[Notice] = [] + self.copywrightListings: List[str] = [] + self.stoppedSongs: List[int] = [] + self.stoppedJackets: List[int] = [] + self.stoppedMovies: List[int] = [] + self.stoppedIcons: List[int] = [] def make(self) -> Dict: note = [] @@ -34,7 +34,7 @@ class GetNewsResponseV1(BaseResponse): class GetNewsResponseV2(GetNewsResponseV1): - stoppedProducts: list[int] = [] + stoppedProducts: List[int] = [] def make(self) -> Dict: super().make() @@ -44,8 +44,8 @@ class GetNewsResponseV2(GetNewsResponseV1): class GetNewsResponseV3(GetNewsResponseV2): - stoppedNavs: list[int] = [] - stoppedNavVoices: list[int] = [] + stoppedNavs: List[int] = [] + stoppedNavVoices: List[int] = [] def make(self) -> Dict: super().make()