Skip to content

Commit cbebb22

Browse files
Improved typing for LRU cache (#135)
* add missing get case * special case to workaround #124
1 parent e81eb2e commit cbebb22

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

asyncstdlib/_lrucache.pyi

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ from typing import (
33
Any,
44
Awaitable,
55
Callable,
6+
Coroutine,
67
Generic,
78
NamedTuple,
89
overload,
@@ -35,6 +36,12 @@ class LRUAsyncCallable(Protocol[AC]):
3536
self: LRUAsyncCallable[AC], instance: None, owner: type | None = ...
3637
) -> LRUAsyncCallable[AC]: ...
3738
@overload
39+
def __get__(
40+
self: LRUAsyncCallable[Callable[Concatenate[S, P], Coroutine[Any, Any, R]]],
41+
instance: S,
42+
owner: type | None = ...,
43+
) -> LRUAsyncBoundCallable[S, P, R]: ...
44+
@overload
3845
def __get__(
3946
self: LRUAsyncCallable[Callable[Concatenate[S, P], Awaitable[R]]],
4047
instance: S,
@@ -51,6 +58,11 @@ class LRUAsyncBoundCallable(Generic[S, P, R]):
5158
__slots__: tuple[str, ...]
5259
__self__: S
5360
__call__: Callable[P, Awaitable[R]]
61+
@overload
62+
def __get__(
63+
self, instance: None, owner: type | None = ...
64+
) -> LRUAsyncBoundCallable[S, P, R]: ...
65+
@overload
5466
def __get__(
5567
self, instance: S2, owner: type | None = ...
5668
) -> LRUAsyncBoundCallable[S2, P, R]: ...

0 commit comments

Comments
 (0)