mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
[redis] Improve redis.asyncio.lock types (#8826)
This commit is contained in:
@@ -1,23 +1,27 @@
|
||||
import threading
|
||||
from _typeshed import Self
|
||||
from collections.abc import Awaitable
|
||||
from typing import Any
|
||||
from types import SimpleNamespace, TracebackType
|
||||
from typing import Any, ClassVar
|
||||
|
||||
from redis.asyncio import Redis
|
||||
from redis.commands.core import AsyncScript
|
||||
|
||||
class Lock:
|
||||
lua_release: Any
|
||||
lua_extend: Any
|
||||
lua_reacquire: Any
|
||||
LUA_RELEASE_SCRIPT: str
|
||||
LUA_EXTEND_SCRIPT: str
|
||||
LUA_REACQUIRE_SCRIPT: str
|
||||
redis: Any
|
||||
name: Any
|
||||
timeout: Any
|
||||
sleep: Any
|
||||
blocking: Any
|
||||
blocking_timeout: Any
|
||||
thread_local: Any
|
||||
local: Any
|
||||
lua_release: ClassVar[AsyncScript | None]
|
||||
lua_extend: ClassVar[AsyncScript | None]
|
||||
lua_reacquire: ClassVar[AsyncScript | None]
|
||||
LUA_RELEASE_SCRIPT: ClassVar[str]
|
||||
LUA_EXTEND_SCRIPT: ClassVar[str]
|
||||
LUA_REACQUIRE_SCRIPT: ClassVar[str]
|
||||
redis: Redis[Any]
|
||||
name: str | bytes | memoryview
|
||||
timeout: float | None
|
||||
sleep: float
|
||||
blocking: bool
|
||||
blocking_timeout: float | None
|
||||
thread_local: bool
|
||||
local: threading.local | SimpleNamespace
|
||||
def __init__(
|
||||
self,
|
||||
redis: Redis[Any],
|
||||
@@ -29,17 +33,19 @@ class Lock:
|
||||
thread_local: bool = ...,
|
||||
) -> None: ...
|
||||
def register_scripts(self) -> None: ...
|
||||
async def __aenter__(self): ...
|
||||
async def __aexit__(self, exc_type, exc_value, traceback) -> None: ...
|
||||
async def __aenter__(self: Self) -> Self: ...
|
||||
async def __aexit__(
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
async def acquire(
|
||||
self, blocking: bool | None = ..., blocking_timeout: float | None = ..., token: str | bytes | None = ...
|
||||
): ...
|
||||
) -> bool: ...
|
||||
async def do_acquire(self, token: str | bytes) -> bool: ...
|
||||
async def locked(self) -> bool: ...
|
||||
async def owned(self) -> bool: ...
|
||||
def release(self) -> Awaitable[None]: ...
|
||||
async def do_release(self, expected_token: bytes): ...
|
||||
async def do_release(self, expected_token: bytes) -> None: ...
|
||||
def extend(self, additional_time: float, replace_ttl: bool = ...) -> Awaitable[bool]: ...
|
||||
async def do_extend(self, additional_time, replace_ttl) -> bool: ...
|
||||
async def do_extend(self, additional_time: float, replace_ttl: bool) -> bool: ...
|
||||
def reacquire(self) -> Awaitable[bool]: ...
|
||||
async def do_reacquire(self) -> bool: ...
|
||||
|
||||
Reference in New Issue
Block a user