From f07f8fa1838d1791695de187b76b4b45ec70f36b Mon Sep 17 00:00:00 2001 From: Max Fischer Date: Mon, 18 Mar 2024 07:30:54 +0100 Subject: [PATCH 1/2] add missing get case --- asyncstdlib/_lrucache.pyi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/asyncstdlib/_lrucache.pyi b/asyncstdlib/_lrucache.pyi index 08fb24c..59b12bd 100644 --- a/asyncstdlib/_lrucache.pyi +++ b/asyncstdlib/_lrucache.pyi @@ -51,6 +51,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]: ... From c84dc771b5cef5ae0c532da22de51c4551b57590 Mon Sep 17 00:00:00 2001 From: Max Fischer Date: Thu, 21 Mar 2024 07:59:29 +0100 Subject: [PATCH 2/2] special case to workaround #124 --- asyncstdlib/_lrucache.pyi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/asyncstdlib/_lrucache.pyi b/asyncstdlib/_lrucache.pyi index 59b12bd..c5fc40e 100644 --- a/asyncstdlib/_lrucache.pyi +++ b/asyncstdlib/_lrucache.pyi @@ -3,6 +3,7 @@ from typing import ( Any, Awaitable, Callable, + Coroutine, Generic, NamedTuple, overload, @@ -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,