-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
bugmypy got something wrongmypy got something wrong
Description
It seems like @overload is not working well with a decorator typed with Concatenate/ParamSpec.
Decorator is typed as:
def acquire(func: Callable[Concatenate[_Client, Connection, _P], Awaitable[_T]]) -> Callable[Concatenate[_Client, _P], Awaitable[_T]]:
The a method with overloads is like:
@overload
async def get(self, key: bytes) -> Optional[bytes]:
...
@overload
async def get(self, key: bytes, default: bytes) -> bytes:
...
@acquire
async def get(
self, conn: Connection, key: bytes, default: Optional[bytes] = None
) -> Optional[bytes]:
Which then gives:
aiomcache/client.py:156: error: Overloaded function implementation does not accept all possible arguments of signature 1 [misc]
aiomcache/client.py:156: error: Overloaded function implementation does not accept all possible arguments of signature 2 [misc]
If I move the @acquire before the first overload, then no type errors are produced (but, the code is now broken).
Code available at: https://github.com/aio-libs/aiomcache/blob/master/aiomcache/client.py#L159
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong