Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/limits/typing.py: 2%
48 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:35 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:35 +0000
1from typing import (
2 TYPE_CHECKING,
3 Callable,
4 Dict,
5 List,
6 NamedTuple,
7 Optional,
8 Tuple,
9 Type,
10 TypeVar,
11 Union,
12)
14from typing_extensions import ClassVar, Counter, ParamSpec, Protocol
16Serializable = Union[int, str, float]
18R = TypeVar("R")
19R_co = TypeVar("R_co", covariant=True)
20P = ParamSpec("P")
23if TYPE_CHECKING:
24 import coredis
25 import coredis.commands.script
26 import redis
29class ItemP(Protocol):
30 value: bytes
31 flags: Optional[int]
32 cas: Optional[int]
35class EmcacheClientP(Protocol):
36 async def add(
37 self,
38 key: bytes,
39 value: bytes,
40 *,
41 flags: int = 0,
42 exptime: int = 0,
43 noreply: bool = False,
44 ) -> None:
45 ...
47 async def get(self, key: bytes, return_flags: bool = False) -> Optional[ItemP]:
48 ...
50 async def gets(self, key: bytes, return_flags: bool = False) -> Optional[ItemP]:
51 ...
53 async def increment(
54 self, key: bytes, value: int, *, noreply: bool = False
55 ) -> Optional[int]:
56 ...
58 async def delete(self, key: bytes, *, noreply: bool = False) -> None:
59 ...
61 async def set(
62 self,
63 key: bytes,
64 value: bytes,
65 *,
66 flags: int = 0,
67 exptime: int = 0,
68 noreply: bool = False,
69 ) -> None:
70 ...
72 async def touch(self, key: bytes, exptime: int, *, noreply: bool = False) -> None:
73 ...
76class MemcachedClientP(Protocol):
77 def add(
78 self,
79 key: str,
80 value: Serializable,
81 expire: Optional[int] = 0,
82 noreply: Optional[bool] = None,
83 flags: Optional[int] = None,
84 ) -> bool:
85 ...
87 def get(self, key: str, default: Optional[str] = None) -> bytes:
88 ...
90 def incr(self, key: str, value: int, noreply: Optional[bool] = False) -> int:
91 ...
93 def delete(self, key: str, noreply: Optional[bool] = None) -> Optional[bool]:
94 ...
96 def set(
97 self,
98 key: str,
99 value: Serializable,
100 expire: int = 0,
101 noreply: Optional[bool] = None,
102 flags: Optional[int] = None,
103 ) -> bool:
104 ...
106 def touch(
107 self, key: str, expire: Optional[int] = 0, noreply: Optional[bool] = None
108 ) -> bool:
109 ...
112AsyncRedisClient = Union["coredis.Redis[bytes]", "coredis.RedisCluster[bytes]"]
113RedisClient = Union["redis.Redis", "redis.cluster.RedisCluster"]
116class ScriptP(Protocol[R_co]):
117 def __call__(self, keys: List[Serializable], args: List[Serializable]) -> R_co:
118 ...
121__all__ = [
122 "AsyncRedisClient",
123 "Callable",
124 "ClassVar",
125 "Counter",
126 "Dict",
127 "EmcacheClientP",
128 "ItemP",
129 "List",
130 "MemcachedClientP",
131 "NamedTuple",
132 "Optional",
133 "P",
134 "ParamSpec",
135 "Protocol",
136 "ScriptP",
137 "Serializable",
138 "TypeVar",
139 "R",
140 "R_co",
141 "RedisClient",
142 "Tuple",
143 "Type",
144 "TypeVar",
145 "Union",
146]