Skip to content

Commit

Permalink
Improved typing for LRU cache (#135)
Browse files Browse the repository at this point in the history
* add missing get case

* special case to workaround #124
  • Loading branch information
maxfischer2781 committed Mar 21, 2024
1 parent e81eb2e commit cbebb22
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions asyncstdlib/_lrucache.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ from typing import (
Any,
Awaitable,
Callable,
Coroutine,
Generic,
NamedTuple,
overload,
Expand Down Expand Up @@ -35,6 +36,12 @@ class LRUAsyncCallable(Protocol[AC]):
self: LRUAsyncCallable[AC], instance: None, owner: type | None = ...
) -> LRUAsyncCallable[AC]: ...
@overload
def __get__(
self: LRUAsyncCallable[Callable[Concatenate[S, P], Coroutine[Any, Any, R]]],
instance: S,
owner: type | None = ...,
) -> LRUAsyncBoundCallable[S, P, R]: ...
@overload
def __get__(
self: LRUAsyncCallable[Callable[Concatenate[S, P], Awaitable[R]]],
instance: S,
Expand All @@ -51,6 +58,11 @@ class LRUAsyncBoundCallable(Generic[S, P, R]):
__slots__: tuple[str, ...]
__self__: S
__call__: Callable[P, Awaitable[R]]
@overload
def __get__(
self, instance: None, owner: type | None = ...
) -> LRUAsyncBoundCallable[S, P, R]: ...
@overload
def __get__(
self, instance: S2, owner: type | None = ...
) -> LRUAsyncBoundCallable[S2, P, R]: ...
Expand Down

0 comments on commit cbebb22

Please sign in to comment.