Skip to content

Commit e2e44a5

Browse files
CopilotTrueRou
andauthored
Optimize type hints for maimai.players() method based on Provider type (#38)
* Initial plan * Implement type hint optimization for maimai.players() method remove tests Co-Authored-By: TrueRou <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: TrueRou <[email protected]>
1 parent 63238f7 commit e2e44a5

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

maimai_py/maimai.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import warnings
55
from collections import defaultdict
66
from functools import cached_property
7-
from typing import Any, AsyncGenerator, Callable, Generic, Iterable, Literal, Optional, Type, TypeVar
7+
from typing import Any, AsyncGenerator, Callable, Generic, Iterable, Literal, Optional, Type, TypeVar, Union, overload
88

99
from aiocache import BaseCache, SimpleMemoryCache
1010
from httpx import AsyncClient
@@ -799,6 +799,18 @@ async def songs(
799799
songs = MaimaiSongs(self)
800800
return await songs._configure(provider, alias_provider, curve_provider)
801801

802+
@overload
803+
async def players(self, identifier: PlayerIdentifier, provider: DivingFishProvider) -> DivingFishPlayer: ...
804+
805+
@overload
806+
async def players(self, identifier: PlayerIdentifier, provider: LXNSProvider) -> LXNSPlayer: ...
807+
808+
@overload
809+
async def players(self, identifier: PlayerIdentifier, provider: ArcadeProvider) -> ArcadePlayer: ...
810+
811+
@overload
812+
async def players(self, identifier: PlayerIdentifier, provider: WechatProvider) -> WechatPlayer: ...
813+
802814
async def players(
803815
self,
804816
identifier: PlayerIdentifier,

0 commit comments

Comments
 (0)