-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy path_lrucache.pyi
97 lines (90 loc) · 2.74 KB
/
_lrucache.pyi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
from typing import (
TypeVar,
Any,
Awaitable,
Callable,
Coroutine,
Generic,
NamedTuple,
overload,
Protocol,
)
from types import CoroutineType
from typing_extensions import ParamSpec, Concatenate
from ._typing import AC, TypedDict
class CacheInfo(NamedTuple):
hits: int
misses: int
maxsize: int | None
currsize: int
class CacheParameters(TypedDict):
maxsize: int | None
typed: bool
R = TypeVar("R")
P = ParamSpec("P")
S = TypeVar("S")
S2 = TypeVar("S2")
class LRUAsyncCallable(Protocol[AC]):
__slots__: tuple[str, ...]
__call__: AC
@overload
def __get__(
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], CoroutineType[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,
owner: type | None = ...,
) -> LRUAsyncBoundCallable[S, P, R]: ...
@property
def __wrapped__(self) -> AC: ...
def cache_parameters(self) -> CacheParameters: ...
def cache_info(self) -> CacheInfo: ...
def cache_clear(self) -> None: ...
def cache_discard(self, *args: Any, **kwargs: Any) -> None: ...
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]: ...
def __init__(
self,
lru: LRUAsyncCallable[Callable[Concatenate[S, P], Awaitable[R]]],
__self__: S,
) -> None: ...
@property
def __wrapped__(self) -> Callable[Concatenate[S, P], Awaitable[R]]: ...
@property
def __func__(
self,
) -> LRUAsyncCallable[Callable[Concatenate[S, P], Awaitable[R]]]: ...
def cache_parameters(self) -> CacheParameters: ...
def cache_info(self) -> CacheInfo: ...
def cache_clear(self) -> None: ...
def cache_discard(self, *args: Any, **kwargs: Any) -> None: ...
@overload
def lru_cache(maxsize: AC, typed: bool = ...) -> LRUAsyncCallable[AC]: ...
@overload
def lru_cache(
maxsize: int | None = ..., typed: bool = ...
) -> Callable[[AC], LRUAsyncCallable[AC]]: ...