From 9dd8b98f7cec7f259034d6c81c88f242bfb8a733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E6=B0=B4=E5=B1=85=E5=AE=A4?= Date: Wed, 27 Dec 2023 15:09:24 +0800 Subject: [PATCH] :truck: Remove enums --- simnet/__init__.py | 2 +- simnet/client/base.py | 2 +- simnet/client/components/auth.py | 2 +- simnet/client/components/calculator/genshin.py | 2 +- simnet/client/components/chronicle/base.py | 2 +- simnet/client/components/chronicle/genshin.py | 2 +- simnet/client/components/chronicle/starrail.py | 2 +- simnet/client/components/daily.py | 2 +- simnet/client/components/diary/base.py | 2 +- simnet/client/components/diary/genshin.py | 2 +- simnet/client/components/diary/starrail.py | 2 +- simnet/client/components/lab.py | 2 +- simnet/client/components/verify.py | 2 +- simnet/client/components/wish/base.py | 2 +- simnet/client/components/wish/genshin.py | 2 +- simnet/client/components/wish/starrail.py | 2 +- simnet/client/genshin.py | 2 +- simnet/client/genshin.pyi | 2 +- simnet/client/routes.py | 2 +- simnet/client/starrail.py | 2 +- simnet/client/starrail.pyi | 2 +- simnet/models/lab/record.py | 2 +- simnet/utils/ds.py | 2 +- simnet/utils/{enum_.py => enums.py} | 0 simnet/utils/player.py | 2 +- tests/conftest.py | 2 +- tests/test_auth_client.py | 2 +- tests/test_base_chronicle_client.py | 2 +- tests/test_genshin.py | 4 ++-- tests/test_genshin_battle_chronicle_client.py | 2 +- tests/test_genshin_calculator_client.py | 2 +- tests/test_genshin_diary_client.py | 2 +- tests/test_lab_client.py | 4 ++-- tests/test_starrail.py | 4 ++-- tests/test_starrail_battle_chronicle_client.py | 2 +- tests/test_starrail_diary_client.py | 2 +- 36 files changed, 38 insertions(+), 38 deletions(-) rename simnet/utils/{enum_.py => enums.py} (100%) diff --git a/simnet/__init__.py b/simnet/__init__.py index 7ac187c..9e9363a 100644 --- a/simnet/__init__.py +++ b/simnet/__init__.py @@ -1,5 +1,5 @@ from simnet.client.genshin import GenshinClient from simnet.client.starrail import StarRailClient -from simnet.utils.enum_ import Game, Region +from simnet.utils.enums import Game, Region __all__ = ("StarRailClient", "GenshinClient", "Game", "Region") diff --git a/simnet/client/base.py b/simnet/client/base.py index 749cd7c..ea8001f 100644 --- a/simnet/client/base.py +++ b/simnet/client/base.py @@ -9,7 +9,7 @@ from simnet.client.cookies import Cookies from simnet.client.headers import Headers from simnet.errors import TimedOut, NetworkError, BadRequest, raise_for_ret_code, NotSupported from simnet.utils.ds import generate_dynamic_secret, DSType, hex_digest -from simnet.utils.enum_ import Region, Game +from simnet.utils.enums import Region, Game from simnet.utils.types import ( RT, HeaderTypes, diff --git a/simnet/client/components/auth.py b/simnet/client/components/auth.py index f36876a..565e2f2 100644 --- a/simnet/client/components/auth.py +++ b/simnet/client/components/auth.py @@ -13,7 +13,7 @@ from simnet.client.routes import ( URL, ) from simnet.errors import RegionNotSupported -from simnet.utils.enum_ import Region +from simnet.utils.enums import Region from simnet.utils.player import recognize_game_biz, recognize_server __all__ = ("AuthClient",) diff --git a/simnet/client/components/calculator/genshin.py b/simnet/client/components/calculator/genshin.py index e3e2a11..5dc773e 100644 --- a/simnet/client/components/calculator/genshin.py +++ b/simnet/client/components/calculator/genshin.py @@ -12,7 +12,7 @@ from simnet.models.genshin.calculator import ( CalculatorCharacterDetails, CalculatorTalent, ) -from simnet.utils.enum_ import Region +from simnet.utils.enums import Region from simnet.utils.player import recognize_genshin_server diff --git a/simnet/client/components/chronicle/base.py b/simnet/client/components/chronicle/base.py index bb575ab..4f53937 100644 --- a/simnet/client/components/chronicle/base.py +++ b/simnet/client/components/chronicle/base.py @@ -4,7 +4,7 @@ from simnet.client.base import BaseClient from simnet.client.routes import RECORD_URL from simnet.errors import DataNotPublic from simnet.models.lab.record import RecordCard -from simnet.utils.enum_ import Region, Game +from simnet.utils.enums import Region, Game from simnet.utils.types import QueryParamTypes __all__ = ("BaseChronicleClient",) diff --git a/simnet/client/components/chronicle/genshin.py b/simnet/client/components/chronicle/genshin.py index 707d66b..c1fec1a 100644 --- a/simnet/client/components/chronicle/genshin.py +++ b/simnet/client/components/chronicle/genshin.py @@ -13,7 +13,7 @@ from simnet.models.genshin.chronicle.stats import ( FullGenshinUserStats, ) from simnet.models.lab.record import RecordCard -from simnet.utils.enum_ import Game, Region +from simnet.utils.enums import Game, Region from simnet.utils.player import recognize_genshin_server, recognize_region __all__ = ("GenshinBattleChronicleClient",) diff --git a/simnet/client/components/chronicle/starrail.py b/simnet/client/components/chronicle/starrail.py index 81cabdc..43626cd 100644 --- a/simnet/client/components/chronicle/starrail.py +++ b/simnet/client/components/chronicle/starrail.py @@ -13,7 +13,7 @@ from simnet.models.starrail.chronicle.notes import StarRailNote, StarRailNoteWid from simnet.models.starrail.chronicle.resident import StarRailResident from simnet.models.starrail.chronicle.rogue import StarRailRogue, StarRailRogueLocust from simnet.models.starrail.chronicle.stats import StarRailUserStats, StarRailUserInfo -from simnet.utils.enum_ import Game, Region +from simnet.utils.enums import Game, Region from simnet.utils.player import recognize_starrail_server, recognize_region __all__ = ("StarRailBattleChronicleClient",) diff --git a/simnet/client/components/daily.py b/simnet/client/components/daily.py index 296dd10..c5035f7 100644 --- a/simnet/client/components/daily.py +++ b/simnet/client/components/daily.py @@ -8,7 +8,7 @@ from simnet.client.base import BaseClient from simnet.client.routes import REWARD_URL from simnet.errors import GeetestTriggered from simnet.models.lab.daily import DailyRewardInfo, DailyReward, ClaimedDailyReward -from simnet.utils.enum_ import Game, Region +from simnet.utils.enums import Game, Region from simnet.utils.player import recognize_genshin_server, recognize_starrail_server __all__ = ("DailyRewardClient",) diff --git a/simnet/client/components/diary/base.py b/simnet/client/components/diary/base.py index 8d54c97..e3902f3 100644 --- a/simnet/client/components/diary/base.py +++ b/simnet/client/components/diary/base.py @@ -5,7 +5,7 @@ from simnet.client.base import BaseClient from simnet.client.routes import DETAIL_LEDGER_URL, INFO_LEDGER_URL from simnet.models.diary import DiaryType from simnet.models.genshin.diary import DiaryPage -from simnet.utils.enum_ import Region, Game +from simnet.utils.enums import Region, Game from simnet.utils.player import recognize_server __all__ = ("BaseDiaryClient",) diff --git a/simnet/client/components/diary/genshin.py b/simnet/client/components/diary/genshin.py index 58d4030..43956ee 100644 --- a/simnet/client/components/diary/genshin.py +++ b/simnet/client/components/diary/genshin.py @@ -2,7 +2,7 @@ from typing import Optional from simnet.client.components.diary.base import BaseDiaryClient from simnet.models.genshin.diary import Diary -from simnet.utils.enum_ import Game +from simnet.utils.enums import Game class GenshinDiaryClient(BaseDiaryClient): diff --git a/simnet/client/components/diary/starrail.py b/simnet/client/components/diary/starrail.py index a88ebc4..567b1dd 100644 --- a/simnet/client/components/diary/starrail.py +++ b/simnet/client/components/diary/starrail.py @@ -2,7 +2,7 @@ from typing import Optional from simnet.client.components.diary.base import BaseDiaryClient from simnet.models.starrail.diary import StarRailDiary -from simnet.utils.enum_ import Game +from simnet.utils.enums import Game class StarrailDiaryClient(BaseDiaryClient): diff --git a/simnet/client/components/lab.py b/simnet/client/components/lab.py index 520215c..0997ab1 100644 --- a/simnet/client/components/lab.py +++ b/simnet/client/components/lab.py @@ -6,7 +6,7 @@ from simnet.client.headers import Headers from simnet.client.routes import TAKUMI_URL, HK4E_URL, CODE_URL, CODE_HOYOLAB_URL from simnet.models.lab.announcement import Announcement from simnet.models.lab.record import PartialUser, FullUser, Account -from simnet.utils.enum_ import Region, Game +from simnet.utils.enums import Region, Game from simnet.utils.lang import create_short_lang_code from simnet.utils.player import recognize_genshin_server, recognize_server, recognize_game_biz from simnet.utils.types import HeaderTypes diff --git a/simnet/client/components/verify.py b/simnet/client/components/verify.py index c8a5fc7..3c80cee 100644 --- a/simnet/client/components/verify.py +++ b/simnet/client/components/verify.py @@ -8,7 +8,7 @@ from httpx import Headers from simnet.client.base import BaseClient from simnet.client.routes import URL from simnet.errors import RegionNotSupported -from simnet.utils.enum_ import Region +from simnet.utils.enums import Region class VerifyClient(BaseClient): diff --git a/simnet/client/components/wish/base.py b/simnet/client/components/wish/base.py index 3078a5c..e72cf9b 100644 --- a/simnet/client/components/wish/base.py +++ b/simnet/client/components/wish/base.py @@ -3,7 +3,7 @@ from urllib.parse import unquote from simnet.client.base import BaseClient from simnet.client.routes import GACHA_INFO_URL -from simnet.utils.enum_ import Game +from simnet.utils.enums import Game from simnet.utils.lang import create_short_lang_code __all__ = ("BaseWishClient",) diff --git a/simnet/client/components/wish/genshin.py b/simnet/client/components/wish/genshin.py index afac629..16401e8 100644 --- a/simnet/client/components/wish/genshin.py +++ b/simnet/client/components/wish/genshin.py @@ -3,7 +3,7 @@ from typing import Optional, List from simnet.client.components.wish.base import BaseWishClient from simnet.models.genshin.wish import Wish -from simnet.utils.enum_ import Game +from simnet.utils.enums import Game from simnet.utils.paginator import WishPaginator __all__ = ("GenshinWishClient",) diff --git a/simnet/client/components/wish/starrail.py b/simnet/client/components/wish/starrail.py index 3106649..c5cc7d1 100644 --- a/simnet/client/components/wish/starrail.py +++ b/simnet/client/components/wish/starrail.py @@ -3,7 +3,7 @@ from typing import Optional, List from simnet.client.components.wish.base import BaseWishClient from simnet.models.starrail.wish import StarRailWish -from simnet.utils.enum_ import Game +from simnet.utils.enums import Game from simnet.utils.paginator import WishPaginator __all__ = ("StarRailWishClient",) diff --git a/simnet/client/genshin.py b/simnet/client/genshin.py index bde259a..3cadd2c 100644 --- a/simnet/client/genshin.py +++ b/simnet/client/genshin.py @@ -9,7 +9,7 @@ from simnet.client.components.lab import LabClient from simnet.client.components.transaction import TransactionClient from simnet.client.components.verify import VerifyClient from simnet.client.components.wish.genshin import GenshinWishClient -from simnet.utils.enum_ import Game +from simnet.utils.enums import Game __all__ = ("GenshinClient",) diff --git a/simnet/client/genshin.pyi b/simnet/client/genshin.pyi index f01dfcc..42fa734 100644 --- a/simnet/client/genshin.pyi +++ b/simnet/client/genshin.pyi @@ -9,7 +9,7 @@ from simnet.client.components.lab import LabClient from simnet.client.components.transaction import TransactionClient from simnet.client.components.verify import VerifyClient from simnet.client.components.wish.genshin import GenshinWishClient -from simnet.utils.enum_ import Region +from simnet.utils.enums import Region from simnet.utils.types import CookieTypes, HeaderTypes, TimeoutTypes class GenshinClient( diff --git a/simnet/client/routes.py b/simnet/client/routes.py index 867271a..b0892ca 100644 --- a/simnet/client/routes.py +++ b/simnet/client/routes.py @@ -4,7 +4,7 @@ from urllib.parse import urljoin from httpx import URL as _URL from simnet.errors import RegionNotSupported, NotSupported -from simnet.utils.enum_ import Region, Game +from simnet.utils.enums import Region, Game URLTypes = Union["URL", str] diff --git a/simnet/client/starrail.py b/simnet/client/starrail.py index b044257..2738f00 100644 --- a/simnet/client/starrail.py +++ b/simnet/client/starrail.py @@ -7,7 +7,7 @@ from simnet.client.components.diary.starrail import StarrailDiaryClient from simnet.client.components.lab import LabClient from simnet.client.components.verify import VerifyClient from simnet.client.components.wish.starrail import StarRailWishClient -from simnet.utils.enum_ import Game +from simnet.utils.enums import Game __all__ = ("StarRailClient",) diff --git a/simnet/client/starrail.pyi b/simnet/client/starrail.pyi index 6701d72..290e61b 100644 --- a/simnet/client/starrail.pyi +++ b/simnet/client/starrail.pyi @@ -7,7 +7,7 @@ from simnet.client.components.diary.starrail import StarrailDiaryClient from simnet.client.components.lab import LabClient from simnet.client.components.verify import VerifyClient from simnet.client.components.wish.starrail import StarRailWishClient -from simnet.utils.enum_ import Region +from simnet.utils.enums import Region from simnet.utils.types import CookieTypes, HeaderTypes, TimeoutTypes class StarRailClient( diff --git a/simnet/models/lab/record.py b/simnet/models/lab/record.py index 59ca692..7ff0f0c 100644 --- a/simnet/models/lab/record.py +++ b/simnet/models/lab/record.py @@ -5,7 +5,7 @@ from typing import Optional, Any, Dict, List, Union, Type from pydantic import Field, validator from simnet.models.base import APIModel -from simnet.utils.enum_ import Game +from simnet.utils.enums import Game __all__ = ( "FullUser", diff --git a/simnet/utils/ds.py b/simnet/utils/ds.py index 19412a5..7245a72 100644 --- a/simnet/utils/ds.py +++ b/simnet/utils/ds.py @@ -6,7 +6,7 @@ import time from enum import Enum from typing import Any, Optional -from simnet.utils.enum_ import Region +from simnet.utils.enums import Region from simnet.utils.types import QueryParamTypes MIYOUSHE_VERSION = "2.66.1" diff --git a/simnet/utils/enum_.py b/simnet/utils/enums.py similarity index 100% rename from simnet/utils/enum_.py rename to simnet/utils/enums.py diff --git a/simnet/utils/player.py b/simnet/utils/player.py index 26a7ade..477e18d 100644 --- a/simnet/utils/player.py +++ b/simnet/utils/player.py @@ -2,7 +2,7 @@ from typing import Optional, Mapping, Sequence -from simnet.utils.enum_ import Game, Region +from simnet.utils.enums import Game, Region UID_RANGE: Mapping[Game, Mapping[Region, Sequence[int]]] = { Game.GENSHIN: { diff --git a/tests/conftest.py b/tests/conftest.py index 1778e8d..2dcd810 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -9,7 +9,7 @@ from dotenv import load_dotenv from simnet.client.cookies import Cookies from simnet.utils.cookies import parse_cookie -from simnet.utils.enum_ import Region +from simnet.utils.enums import Region env_path = Path(".env") if env_path.exists(): diff --git a/tests/test_auth_client.py b/tests/test_auth_client.py index 91a80f4..6596817 100644 --- a/tests/test_auth_client.py +++ b/tests/test_auth_client.py @@ -4,7 +4,7 @@ import pytest import pytest_asyncio from simnet.client.components.auth import AuthClient -from simnet.utils.enum_ import Region +from simnet.utils.enums import Region from simnet.utils.player import recognize_genshin_server, recognize_genshin_game_biz if TYPE_CHECKING: diff --git a/tests/test_base_chronicle_client.py b/tests/test_base_chronicle_client.py index 2127d70..f45a49e 100644 --- a/tests/test_base_chronicle_client.py +++ b/tests/test_base_chronicle_client.py @@ -7,7 +7,7 @@ from simnet.client.components.chronicle.base import BaseChronicleClient if TYPE_CHECKING: from simnet.client.cookies import Cookies - from simnet.utils.enum_ import Region + from simnet.utils.enums import Region @pytest_asyncio.fixture diff --git a/tests/test_genshin.py b/tests/test_genshin.py index 3b21359..df96067 100644 --- a/tests/test_genshin.py +++ b/tests/test_genshin.py @@ -4,11 +4,11 @@ import pytest import pytest_asyncio from simnet.client.genshin import GenshinClient -from simnet.utils.enum_ import Game +from simnet.utils.enums import Game if TYPE_CHECKING: from simnet.client.cookies import Cookies - from simnet.utils.enum_ import Region + from simnet.utils.enums import Region @pytest_asyncio.fixture diff --git a/tests/test_genshin_battle_chronicle_client.py b/tests/test_genshin_battle_chronicle_client.py index cc41426..4ae5ad9 100644 --- a/tests/test_genshin_battle_chronicle_client.py +++ b/tests/test_genshin_battle_chronicle_client.py @@ -8,7 +8,7 @@ from simnet.models.genshin.chronicle.stats import FullGenshinUserStats, Stats if TYPE_CHECKING: from simnet.client.cookies import Cookies - from simnet.utils.enum_ import Region + from simnet.utils.enums import Region @pytest_asyncio.fixture diff --git a/tests/test_genshin_calculator_client.py b/tests/test_genshin_calculator_client.py index 4b9ed90..d939e97 100644 --- a/tests/test_genshin_calculator_client.py +++ b/tests/test_genshin_calculator_client.py @@ -8,7 +8,7 @@ from simnet.client.components.chronicle.genshin import GenshinBattleChronicleCli if TYPE_CHECKING: from simnet.client.cookies import Cookies - from simnet.utils.enum_ import Region + from simnet.utils.enums import Region @pytest_asyncio.fixture diff --git a/tests/test_genshin_diary_client.py b/tests/test_genshin_diary_client.py index 327291e..c0df83c 100644 --- a/tests/test_genshin_diary_client.py +++ b/tests/test_genshin_diary_client.py @@ -7,7 +7,7 @@ from simnet.client.components.diary.genshin import GenshinDiaryClient if TYPE_CHECKING: from simnet.client.cookies import Cookies - from simnet.utils.enum_ import Region + from simnet.utils.enums import Region @pytest_asyncio.fixture diff --git a/tests/test_lab_client.py b/tests/test_lab_client.py index e20373a..9a7fba2 100644 --- a/tests/test_lab_client.py +++ b/tests/test_lab_client.py @@ -4,11 +4,11 @@ import pytest import pytest_asyncio from simnet.client.components.lab import LabClient -from simnet.utils.enum_ import Game +from simnet.utils.enums import Game if TYPE_CHECKING: from simnet.client.cookies import Cookies - from simnet.utils.enum_ import Region + from simnet.utils.enums import Region @pytest_asyncio.fixture diff --git a/tests/test_starrail.py b/tests/test_starrail.py index e7eed12..649be70 100644 --- a/tests/test_starrail.py +++ b/tests/test_starrail.py @@ -4,11 +4,11 @@ import pytest import pytest_asyncio from simnet.client.starrail import StarRailClient -from simnet.utils.enum_ import Game +from simnet.utils.enums import Game if TYPE_CHECKING: from simnet.client.cookies import Cookies - from simnet.utils.enum_ import Region + from simnet.utils.enums import Region @pytest_asyncio.fixture diff --git a/tests/test_starrail_battle_chronicle_client.py b/tests/test_starrail_battle_chronicle_client.py index 35a529e..d8f575a 100644 --- a/tests/test_starrail_battle_chronicle_client.py +++ b/tests/test_starrail_battle_chronicle_client.py @@ -8,7 +8,7 @@ from simnet.errors import NeedChallenge if TYPE_CHECKING: from simnet.client.cookies import Cookies - from simnet.utils.enum_ import Region + from simnet.utils.enums import Region @pytest_asyncio.fixture diff --git a/tests/test_starrail_diary_client.py b/tests/test_starrail_diary_client.py index ec03dac..e83885d 100644 --- a/tests/test_starrail_diary_client.py +++ b/tests/test_starrail_diary_client.py @@ -7,7 +7,7 @@ from simnet.client.components.diary.starrail import StarrailDiaryClient if TYPE_CHECKING: from simnet.client.cookies import Cookies - from simnet.utils.enum_ import Region + from simnet.utils.enums import Region @pytest_asyncio.fixture